@Test public void syntaxNotRequired() throws Exception { String proto = "message Foo {}"; ProtoFileElement parsed = ProtoParser.parse(location, proto); assertThat(parsed.syntax()).isNull(); }
static ProtoFile get(ProtoFileElement protoFileElement) { String packageName = protoFileElement.packageName(); ImmutableList<Type> types = Type.fromElements(packageName, protoFileElement.types()); ImmutableList<Service> services = Service.fromElements(packageName, protoFileElement.services()); ImmutableList<Extend> wireExtends = Extend.fromElements(packageName, protoFileElement.extendDeclarations()); Options options = new Options(Options.FILE_OPTIONS, protoFileElement.options()); return new ProtoFile(protoFileElement.location(), protoFileElement.imports(), protoFileElement.publicImports(), packageName, types, services, wireExtends, options, protoFileElement.syntax()); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ProtoFileElement) { ProtoFileElement that = (ProtoFileElement) o; return (this.location.equals(that.location())) && ((this.packageName == null) ? (that.packageName() == null) : this.packageName.equals(that.packageName())) && ((this.syntax == null) ? (that.syntax() == null) : this.syntax.equals(that.syntax())) && (this.imports.equals(that.imports())) && (this.publicImports.equals(that.publicImports())) && (this.types.equals(that.types())) && (this.services.equals(that.services())) && (this.extendDeclarations.equals(that.extendDeclarations())) && (this.options.equals(that.options())); } return false; }
Builder(ProtoFileElement source) { this.location = source.location(); this.packageName = source.packageName(); this.syntax = source.syntax(); this.imports = source.imports(); this.publicImports = source.publicImports(); this.types = source.types(); this.services = source.services(); this.extendDeclarations = source.extendDeclarations(); this.options = source.options(); } @Override
static ProtoFile get(ProtoFileElement protoFileElement) { String packageName = protoFileElement.packageName(); ImmutableList<Type> types = Type.fromElements(packageName, protoFileElement.types()); ImmutableList<Service> services = Service.fromElements(packageName, protoFileElement.services()); ImmutableList<Extend> wireExtends = Extend.fromElements(packageName, protoFileElement.extendDeclarations()); Options options = new Options(Options.FILE_OPTIONS, protoFileElement.options()); return new ProtoFile(protoFileElement.location(), protoFileElement.imports(), protoFileElement.publicImports(), packageName, types, services, wireExtends, options, protoFileElement.syntax()); }
static ProtoFile get(ProtoFileElement protoFileElement) { String packageName = protoFileElement.packageName(); ImmutableList<Type> types = Type.fromElements(packageName, protoFileElement.types()); ImmutableList<Service> services = Service.fromElements(packageName, protoFileElement.services()); ImmutableList<Extend> wireExtends = Extend.fromElements(packageName, protoFileElement.extendDeclarations()); Options options = new Options(Options.FILE_OPTIONS, protoFileElement.options()); return new ProtoFile(protoFileElement.location(), protoFileElement.imports(), protoFileElement.publicImports(), packageName, types, services, wireExtends, options, protoFileElement.syntax()); }