/** Returns a new proto file that omits types and services not in {@code identifiers}. */ ProtoFile retainAll(Schema schema, MarkSet markSet) { ImmutableList.Builder<Type> retainedTypes = ImmutableList.builder(); for (Type type : types) { Type retainedType = type.retainAll(schema, markSet); if (retainedType != null) { retainedTypes.add(retainedType); } } ImmutableList.Builder<Service> retainedServices = ImmutableList.builder(); for (Service service : services) { Service retainedService = service.retainAll(schema, markSet); if (retainedService != null) { retainedServices.add(retainedService); } } ProtoFile result = new ProtoFile(location, imports, publicImports, packageName, retainedTypes.build(), retainedServices.build(), extendList, options.retainAll(schema, markSet), syntax); result.javaPackage = javaPackage; return result; }
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()); }
/** Returns a new proto file that omits types and services not in {@code identifiers}. */ ProtoFile retainAll(Schema schema, MarkSet markSet) { ImmutableList.Builder<Type> retainedTypes = ImmutableList.builder(); for (Type type : types) { Type retainedType = type.retainAll(schema, markSet); if (retainedType != null) { retainedTypes.add(retainedType); } } ImmutableList.Builder<Service> retainedServices = ImmutableList.builder(); for (Service service : services) { Service retainedService = service.retainAll(schema, markSet); if (retainedService != null) { retainedServices.add(retainedService); } } ProtoFile result = new ProtoFile(location, imports, publicImports, packageName, retainedTypes.build(), retainedServices.build(), extendList, options.retainAll(schema, markSet), syntax); result.javaPackage = javaPackage; return result; }
/** Returns a new proto file that omits types and services not in {@code identifiers}. */ ProtoFile retainAll(Schema schema, MarkSet markSet) { ImmutableList.Builder<Type> retainedTypes = ImmutableList.builder(); for (Type type : types) { Type retainedType = type.retainAll(schema, markSet); if (retainedType != null) { retainedTypes.add(retainedType); } } ImmutableList.Builder<Service> retainedServices = ImmutableList.builder(); for (Service service : services) { Service retainedService = service.retainAll(schema, markSet); if (retainedService != null) { retainedServices.add(retainedService); } } ProtoFile result = new ProtoFile(location, imports, publicImports, packageName, retainedTypes.build(), retainedServices.build(), extendList, options.retainAll(schema, markSet), syntax); result.javaPackage = javaPackage; return result; }
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()); }