2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-04 10:18:20 +00:00
Files
esiur-dart/lib/src/Resource/FactoryEntry.dart
2022-03-12 16:21:29 +03:00

34 lines
720 B
Dart

import '../Data/RepresentationType.dart';
// class DumClass<T> {
// Type type = T;
// }
// Type getNullableType<T>() => DumClass<T?>().type;
// Type getTypeOf<T>() => DumClass<T>().type;
class FactoryEntry<T> {
Type get type => T;
late Type nullableType;
final Function instanceCreator;
final Function arrayCreator = () => <T>[];
final RepresentationType representationType;
bool isMapKeySubType(Map map) {
return map is Map<T, dynamic>;
}
bool isMapValueSubType(Map map) {
return map is Map<dynamic, T>;
}
bool isListSubType(List list) {
return list is List<T>;
}
FactoryEntry(this.instanceCreator, this.representationType) {
nullableType = getNullableType<T>();
}
}