public static Builder builder(Location location) { return new AutoValue_EnumConstantElement.Builder() .location(location) .documentation("") .options(ImmutableList.<OptionElement>of()); }
@Test public void fieldWithDocumentationToSchema() { EnumConstantElement value = EnumConstantElement.builder(location) .name("NAME") .tag(1) .documentation("Hello") .build(); String expected = "" + "// Hello\n" + "NAME = 1;\n"; assertThat(value.toSchema()).isEqualTo(expected); }
.name("CREAM") .tag(2) .documentation("Yummy, yummy cream.") .build(), EnumConstantElement.builder(location.at(13, 3)) .name("SYRUP") .tag(3) .documentation("Quebec Maple syrup") .build())) .build()))
return builder.documentation(documentation) .options(options.build()) .build();
/** Reads an enum constant like "ROCK = 0;". The label is the constant name. */ private EnumConstantElement readEnumConstant( String documentation, Location location, String label) { reader.require('='); int tag = reader.readInt(); ImmutableList.Builder<OptionElement> options = ImmutableList.builder(); if (reader.peekChar() == '[') { reader.readChar(); while (true) { options.add(readOption('=')); char c = reader.readChar(); if (c == ']') { break; } if (c != ',') { throw reader.unexpected("Expected ',' or ']"); } } } reader.require(';'); documentation = reader.tryAppendTrailingDocumentation(documentation); return EnumConstantElement.builder(location) .name(label) .tag(tag) .documentation(documentation) .options(options.build()) .build(); }
public static Builder builder(Location location) { return new AutoValue_EnumConstantElement.Builder() .location(location) .documentation("") .options(ImmutableList.<OptionElement>of()); }
public static Builder builder(Location location) { return new AutoValue_EnumConstantElement.Builder() .location(location) .documentation("") .options(ImmutableList.<OptionElement>of()); }
EnumConstantElement toElement() { return EnumConstantElement.builder(location) .documentation(documentation) .name(name) .tag(tag) .options(options.toElements()) .build(); }
EnumConstantElement toElement() { return EnumConstantElement.builder(location) .documentation(documentation) .name(name) .tag(tag) .options(options.toElements()) .build(); }
.name("CREAM") .tag(2) .documentation("Yummy, yummy cream.") .build(), EnumConstantElement.builder(location.at(11, 3)) .name("SYRUP") .tag(3) .documentation("Quebec Maple syrup") .build())) .build()))
/** Reads an enum constant like "ROCK = 0;". The label is the constant name. */ private EnumConstantElement readEnumConstant( String documentation, Location location, String label) { reader.require('='); int tag = reader.readInt(); ImmutableList<OptionElement> options = new OptionReader(reader).readOptions(); reader.require(';'); documentation = reader.tryAppendTrailingDocumentation(documentation); return EnumConstantElement.builder(location) .name(label) .tag(tag) .documentation(documentation) .options(options) .build(); }
EnumConstantElement toElement() { return EnumConstantElement.builder(location) .documentation(documentation) .name(name) .tag(tag) .options(options.toElements()) .build(); }