"use strict";
var StructurePropertyWrapper_1 = require("./StructurePropertyWrapper");
var StructureTypeParameterWrapper_1 = require("./StructureTypeParameterWrapper");
var StructureTypeWrapper_1 = require("./StructureTypeWrapper");
var StructureWrapper_1 = require("./StructureWrapper");
var WrapperFactory = (function () {
function WrapperFactory(transformOptions) {
this.transformOptions = transformOptions;
this.structureWrappers = [];
}
WrapperFactory.prototype.getStructure = function (definition) {
// ensure only one wrapper per class is created (otherwise infinite loop will ensue when checking if a structure already exists)
var existing = this.structureWrappers.filter(function (s) { return s.definition === definition; })[0];
if (existing != null)
return existing.wrapper;
var wrapper = new StructureWrapper_1.StructureWrapper(this, this.transformOptions, definition);
this.structureWrappers.push({
wrapper: wrapper,
definition: definition
});
return wrapper;
};
WrapperFactory.prototype.getStructureProperty = function (parent, definition) {
return new StructurePropertyWrapper_1.StructurePropertyWrapper(this, this.transformOptions, parent, definition);
};
WrapperFactory.prototype.getStructureTypeParameter = function (structure, typeParamDefinition) {
return new StructureTypeParameterWrapper_1.StructureTypeParameterWrapper(this, structure, typeParamDefinition);
};
WrapperFactory.prototype.getStructureType = function (structure, typeDef) {
return new StructureTypeWrapper_1.StructureTypeWrapper(this, this.transformOptions, structure, typeDef);
};
return WrapperFactory;
}());
exports.WrapperFactory = WrapperFactory;
//# sourceMappingURL=WrapperFactory.js.map
|