castCollection method
Casts o
to this collection type if a ClassReflection or EnumReflection
for it is registered at ReflectionFactory.
Implementation
Object castCollection(Object o, {bool nullable = false}) {
var mainType = isCollection ? (argumentType(0) ?? TypeInfo.tDynamic) : this;
var reflectionFactory = ReflectionFactory();
var reflection =
reflectionFactory.getRegisterClassReflection(mainType.type) ??
reflectionFactory.getRegisterEnumReflection(mainType.type);
if (reflection != null) {
return reflection.castCollection(o, this, nullable: nullable) ?? o;
}
return o;
}