protected void addFullConstructor(EntityType model, CodeWriter writer) throws IOException { // public empty constructor writer.beginConstructor(); writer.end(); // full constructor writer.beginConstructor(model.getProperties(), propertyToParameter); for (Property property : model.getProperties()) { writer.line("this.", property.getEscapedName(), " = ", property.getEscapedName(), ";"); } writer.end(); }
protected void constructorsForVariables(CodeWriter writer, EntityType model) throws IOException { String localName = writer.getRawName(model); String genericName = writer.getGenericName(true, model); boolean stringOrBoolean = model.getOriginalCategory() == TypeCategory.STRING || model.getOriginalCategory() == TypeCategory.BOOLEAN; boolean hasEntityFields = model.hasEntityFields() || superTypeHasEntityFields(model); String thisOrSuper = hasEntityFields ? THIS : SUPER; String additionalParams = hasEntityFields ? "" : getAdditionalConstructorParameter(model); if (!localName.equals(genericName)) { suppressAllWarnings(writer); } writer.beginConstructor(new Parameter("variable", Types.STRING)); if (stringOrBoolean) { writer.line(thisOrSuper,"(forVariable(variable)",additionalParams,");"); } else { writer.line(thisOrSuper,"(", localName.equals(genericName) ? EMPTY : "(Class) ", writer.getClassConstant(localName) + COMMA + "forVariable(variable)", hasEntityFields ? ", INITS" : EMPTY, additionalParams,");"); } if (!hasEntityFields) { constructorContent(writer, model); } writer.end(); }
if (model.isFinal()) { Type type = new ClassType(Path.class, simpleModel); writer.beginConstructor(new Parameter("path", type)); } else { Type type = new ClassType(Path.class, new TypeExtends(simpleModel)); writer.beginConstructor(new Parameter("path", type)); writer.beginConstructor(PATH_METADATA); writer.line("this(metadata, PathInits.getFor(metadata, INITS));"); writer.end(); suppressAllWarnings(writer); writer.beginConstructor(PATH_METADATA); if (stringOrBoolean) { writer.line("super(metadata);"); suppressAllWarnings(writer); writer.beginConstructor(PATH_METADATA, PATH_INITS); writer.line(thisOrSuper, "(", classCast, writer.getClassConstant(localName) + COMMA + "metadata, inits" + additionalParams + ");"); if (!hasEntityFields) { writer.beginConstructor(new Parameter("type", type), PATH_METADATA, PATH_INITS); writer.line("super(type, metadata, inits" + additionalParams + ");"); initEntityFields(writer, config, model);
final boolean asExpr = sizes.add(c.getParameters().size()); writer.beginConstructor(c.getParameters(), new Function<Parameter,Parameter>() { @Override public Parameter apply(Parameter p) {
protected void addFullConstructor(EntityType model, CodeWriter writer) throws IOException { // public empty constructor writer.beginConstructor(); writer.end(); // full constructor writer.beginConstructor(model.getProperties(), propertyToParameter); for (Property property : model.getProperties()) { writer.line("this.", property.getEscapedName(), " = ", property.getEscapedName(), ";"); } writer.end(); }
protected void addFullConstructor(EntityType model, CodeWriter writer) throws IOException { // public empty constructor writer.beginConstructor(); writer.end(); // full constructor writer.beginConstructor(model.getProperties(), propertyToParameter); for (Property property : model.getProperties()) { writer.line("this.", property.getEscapedName(), " = ", property.getEscapedName(), ";"); } writer.end(); }
protected void addFullConstructor(EntityType model, CodeWriter writer) throws IOException { // public empty constructor writer.beginConstructor(); writer.end(); // full constructor writer.beginConstructor(model.getProperties(), propertyToParameter); for (Property property : model.getProperties()) { writer.line("this.", property.getEscapedName(), " = ", property.getEscapedName(), ";"); } writer.end(); }
@Override protected void constructorsForVariables(CodeWriter writer, EntityType model) throws IOException { super.constructorsForVariables(writer, model); String localName = writer.getRawName(model); String genericName = writer.getGenericName(true, model); if (!localName.equals(genericName)) { writer.suppressWarnings("all"); } writer.beginConstructor(new Parameter("variable", Types.STRING), new Parameter("schema", Types.STRING), new Parameter("table", Types.STRING)); writer.line(SUPER,"(", writer.getClassConstant(localName) + COMMA + "forVariable(variable), schema, table);"); constructorContent(writer, model); writer.end(); writer.beginConstructor(new Parameter("variable", Types.STRING), new Parameter("schema", Types.STRING)); writer.line(SUPER, "(", writer.getClassConstant(localName), COMMA, "forVariable(variable), schema, \"", model.getData().get("table").toString(), "\");"); constructorContent(writer, model); writer.end(); }
@Override protected void constructorsForVariables(CodeWriter writer, EntityType model) throws IOException { super.constructorsForVariables(writer, model); String localName = writer.getRawName(model); String genericName = writer.getGenericName(true, model); if (!localName.equals(genericName)) { writer.suppressWarnings("all"); } writer.beginConstructor(new Parameter("variable", Types.STRING), new Parameter("schema", Types.STRING), new Parameter("table", Types.STRING)); writer.line(SUPER,"(", writer.getClassConstant(localName) + COMMA + "forVariable(variable), schema, table);"); constructorContent(writer, model); writer.end(); }