@yellicode/elements
Version:
The meta model API for Yellicode - an extensible code generator.
30 lines (29 loc) • 1.1 kB
JavaScript
import { primitiveBooleanType, primitiveIntegerType, primitiveRealType, primitiveStringType, primitiveObjectType } from './primitives';
/**
* Resolves built-in primitive types. An additional custom resolver
* can be provided to resolve custom applciation types that are not
* part of a profile.
*/
var BasicTypeResolver = /** @class */ (function () {
function BasicTypeResolver(customResolver) {
this.customResolver = customResolver;
}
BasicTypeResolver.prototype.resolve = function (id) {
switch (id) {
case 'boolean_id':
return primitiveBooleanType;
case 'integer_id':
return primitiveIntegerType;
case 'real_id':
return primitiveRealType;
case 'string_id':
return primitiveStringType;
case 'object_id':
return primitiveObjectType;
}
if (this.customResolver)
return this.customResolver.resolve(id);
};
return BasicTypeResolver;
}());
export { BasicTypeResolver };