2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-05-06 04:22:58 +00:00
esiur-js/src/Resource/FactoryEntry.js
2022-03-13 11:28:38 +03:00

34 lines
866 B
JavaScript

export default class FactoryEntry {
//Type get type => T;
//late Type nullableType;
//final Function instanceCreator;
//final Function arrayCreator = () => <T>[];
//final RepresentationType representationType;
isMapKeySubType(map) {
//return map is Map<T, dynamic>;
}
isMapValueSubType(map) {
//return map is Map<dynamic, T>;
}
isListSubType(list) {
//return list is List<T>;
}
constructor(type, representationType) {
this.type = type;
this.nullableType = this.getNullableType(type);
this.representationType = representationType;
}
getNullableType(type){
let c = class extends type {};
Object.defineProperty(c, "name", {value: "Nullable" + type.name});
Object.defineProperty(c, "nullable", {value: true});
return c;
}
}