using afIoc
class Utils {
static Log getLog(Type type) {
// Log.get(type.pod.name + "." + type.name)
type.pod.log
}
static Obj dependencyByType(Type dependencyType) {
registry.dependencyByType(dependencyType)
}
static Obj injectIntoFields(Obj obj) {
registry.injectIntoFields(obj)
}
static Obj autobuild(Type type, Obj?[] ctorArgs := Obj#.emptyList) {
registry.autobuild(type, ctorArgs)
}
private static Registry registry() {
(Service.find(IocService#) as IocService).registry
}
static TimeZone timeZone() {
TimeZone.fromStr("GB") // Europe/London
}
static Date today() {
Date.today(timeZone)
}
static DateTime now() {
DateTime.now.toTimeZone(timeZone)
}
static Obj:Obj makeMap(Type keyType, Type valType) {
mapType := Map#.parameterize(["K":keyType, "V":valType])
return keyType.fits(Str#) ? Map.make(mapType) { caseInsensitive = true } : Map.make(mapType) { ordered = true }
}
}