ph-dev-tools
Version:
Development Tools for PHibernate
36 lines • 1.59 kB
JavaScript
;
const QBuilder_1 = require("./../QBuilder");
/**
* Created by Papa on 4/25/2016.
*/
class QPropertyBuilder {
constructor(parentBuilder, //
propertyDocEntry //
) {
this.parentBuilder = parentBuilder;
this.propertyDocEntry = propertyDocEntry;
}
build() {
let prop = this.propertyDocEntry;
let clazz = this.parentBuilder.entity.docEntry.name;
let qClazz = `Q${clazz}`;
let name = prop.name;
let fieldClass = QBuilder_1.getPropertyFieldClass(prop);
let type = `${fieldClass}<${qClazz}>`;
return `${name} = new ${type}(this, ${qClazz}, '${clazz}', '${name}');`;
}
buildInterfaceDefinition() {
let prop = this.propertyDocEntry;
let name = prop.name;
// let clazz = this.parentBuilder.entity.docEntry.name;
let fieldInterface = QBuilder_1.getPropertyFieldInterface(prop);
// let typedOperationInterface = `${getPropertyTypedOperationInterface(prop)}<I${clazz}>`;
let typedOperationInterface = QBuilder_1.getPropertyTypedOperationInterface(prop);
// let jsonOperationInterface = `${getPropertyJSONOperationInterface(prop)}<I${clazz}>`;
let jsonOperationInterface = QBuilder_1.getPropertyJSONOperationInterface(prop);
let type = `${fieldInterface}<any>`;
return `${name}?: ${type} | ${typedOperationInterface} | ${jsonOperationInterface} | ${prop.primitive};`;
}
}
exports.QPropertyBuilder = QPropertyBuilder;
//# sourceMappingURL=QPropertyBuilder.js.map