public final String toSchema() { StringBuilder builder = new StringBuilder(); appendDocumentation(builder, documentation()); if (label() != null) { builder.append(label().name().toLowerCase(Locale.US)).append(' '); } builder.append(type()) .append(' ') .append(name()) .append(" = ") .append(tag()); if (!options().isEmpty()) { builder.append(" "); Util.appendOptions(builder, options()); } return builder.append(";\n").toString(); }
static ImmutableList<Field> fromElements(String packageName, ImmutableList<FieldElement> fieldElements, boolean extension) { ImmutableList.Builder<Field> fields = ImmutableList.builder(); for (FieldElement field : fieldElements) { fields.add(new Field(packageName, field.location(), field.label(), field.name(), field.documentation(), field.tag(), field.defaultValue(), field.type(), new Options(Options.FIELD_OPTIONS, field.options()), extension)); } return fields.build(); }
public final String toSchema() { StringBuilder builder = new StringBuilder(); appendDocumentation(builder, documentation()); if (label() != null) { builder.append(label().name().toLowerCase(Locale.US)).append(' '); } builder.append(type()) .append(' ') .append(name()) .append(" = ") .append(tag()); if (!options().isEmpty()) { builder.append(" [\n"); for (OptionElement option : options()) { appendIndented(builder, option.toSchema()); } builder.append(']'); } return builder.append(";\n").toString(); }
public final String toSchema() { StringBuilder builder = new StringBuilder(); appendDocumentation(builder, documentation()); if (label() != null) { builder.append(label().name().toLowerCase(Locale.US)).append(' '); } builder.append(type()) .append(' ') .append(name()) .append(" = ") .append(tag()); if (!options().isEmpty()) { builder.append(" [\n"); for (OptionElement option : options()) { appendIndented(builder, option.toSchema()); } builder.append(']'); } return builder.append(";\n").toString(); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof FieldElement) { FieldElement that = (FieldElement) o; return (this.location.equals(that.location())) && ((this.label == null) ? (that.label() == null) : this.label.equals(that.label())) && (this.type.equals(that.type())) && (this.name.equals(that.name())) && ((this.defaultValue == null) ? (that.defaultValue() == null) : this.defaultValue.equals(that.defaultValue())) && (this.tag == that.tag()) && (this.documentation.equals(that.documentation())) && (this.options.equals(that.options())); } return false; }
static ImmutableList<Field> fromElements(String packageName, ImmutableList<FieldElement> fieldElements, boolean extension) { ImmutableList.Builder<Field> fields = ImmutableList.builder(); for (FieldElement field : fieldElements) { fields.add(new Field(packageName, field.location(), field.label(), field.name(), field.documentation(), field.tag(), field.defaultValue(), field.type(), new Options(Options.FIELD_OPTIONS, field.options()), extension)); } return fields.build(); }
static ImmutableList<Field> fromElements(String packageName, ImmutableList<FieldElement> fieldElements, boolean extension) { ImmutableList.Builder<Field> fields = ImmutableList.builder(); for (FieldElement field : fieldElements) { fields.add(new Field(packageName, field.location(), field.label(), field.name(), field.documentation(), field.tag(), field.defaultValue(), field.type(), new Options(Options.FIELD_OPTIONS, field.options()), extension)); } return fields.build(); }
Builder(FieldElement source) { this.location = source.location(); this.label = source.label(); this.type = source.type(); this.name = source.name(); this.defaultValue = source.defaultValue(); this.tag = source.tag(); this.documentation = source.documentation(); this.options = source.options(); } @Override