private static String[] getFullyQualifiedClassName(Descriptors.Descriptor container, final FileOptions fileOpts, String name) { if (fileOpts.getJavaMultipleFiles()) { LinkedList<String> fqnSegments = new LinkedList<>(); fqnSegments.push(name); while (container != null) { fqnSegments.push(container.getName()); container = container.getContainingType(); } fqnSegments.push(fileOpts.getJavaPackage()); return fqnSegments.toArray(new String[] {}); } return new String[] {fileOpts.getJavaPackage(), fileOpts.getJavaOuterClassname(), name}; }
private String getNamespace(FileDescriptor fd, Descriptor containing) { FileOptions o = fd.getOptions(); String p = o.hasJavaPackage() ? o.getJavaPackage() : fd.getPackage(); String outer; if (o.hasJavaOuterClassname()) { outer = o.getJavaOuterClassname(); } else { outer = new File(fd.getName()).getName(); outer = outer.substring(0, outer.lastIndexOf('.')); outer = toCamelCase(outer); } String inner = ""; while (containing != null) { inner = containing.getName() + "$" + inner; containing = containing.getContainingType(); } return p + "." + outer + "$" + inner; }
hash = (53 * hash) + getJavaOuterClassname().hashCode();
private static String getJavaOuterClassname( DescriptorProtos.FileDescriptorProto fileDescriptor, DescriptorProtos.FileOptions fileOptions) { if (fileOptions.hasJavaOuterClassname()) { return fileOptions.getJavaOuterClassname(); } // If the outer class name is not explicitly defined, then we take the proto filename, strip its extension, // and convert it from snake case to camel case. String filename = fileDescriptor.getName().substring(0, fileDescriptor.getName().length() - ".proto".length()); // Protos in subdirectories without java_outer_classname have their path prepended to the filename. Remove // if present. if (filename.contains("/")) { filename = filename.substring(filename.lastIndexOf('/') + 1); } filename = makeInvalidCharactersUnderscores(filename); filename = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, filename); filename = upcaseAfterNumber(filename); filename = appendOuterClassSuffix(filename, fileDescriptor); return filename; }
private String getNamespace(FileDescriptor fd, Descriptor containing) { FileOptions o = fd.getOptions(); String p = o.hasJavaPackage() ? o.getJavaPackage() : fd.getPackage(); String outer; if (o.hasJavaOuterClassname()) { outer = o.getJavaOuterClassname(); } else { outer = new File(fd.getName()).getName(); outer = outer.substring(0, outer.lastIndexOf('.')); outer = toCamelCase(outer); } String inner = ""; while (containing != null) { inner = containing.getName() + "$" + inner; containing = containing.getContainingType(); } return p + "." + outer + "$" + inner; }
/** * <code>optional string java_outer_classname = 8;</code> * * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**
private static String getJavaOuterClassname( DescriptorProtos.FileDescriptorProto fileDescriptor, DescriptorProtos.FileOptions fileOptions) { if (fileOptions.hasJavaOuterClassname()) { return fileOptions.getJavaOuterClassname(); } // If the outer class name is not explicitly defined, then we take the proto filename, strip its extension, // and convert it from snake case to camel case. String filename = fileDescriptor.getName().substring(0, fileDescriptor.getName().length() - ".proto".length()); // Protos in subdirectories without java_outer_classname have their path prepended to the filename. Remove // if present. if (filename.contains("/")) { filename = filename.substring(filename.lastIndexOf('/') + 1); } filename = makeInvalidCharactersUnderscores(filename); filename = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, filename); filename = upcaseAfterNumber(filename); filename = appendOuterClassSuffix(filename, fileDescriptor); return filename; }
/** * <code>optional string java_outer_classname = 8;</code> * * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**
/** * <code>optional string java_outer_classname = 8;</code> * * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**
/** * Returns the qualified type of the protobuf message, for example: * <ul> * <li>org.waveprotocol.pst.examples.Example1.Person = * "org.waveprotocol.pst.examples.Example1.Person"</li> * </ul> * * @return the full type of the protocol buffer message */ public String getProtoType() { Deque<String> scopes = Lists.newLinkedList(); for (Descriptor message = descriptor; message != null; message = message.getContainingType()) { scopes.push(message.getName()); } scopes.push(descriptor.getFile().getOptions().getJavaOuterClassname()); scopes.push(getPackageBase()); return Joiner.on('.').join(scopes); }
/** * <code>optional string java_outer_classname = 8;</code> * * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**
/** * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> * * <code>optional string java_outer_classname = 8;</code> */ private void clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); } /**
/** * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> * * <code>optional string java_outer_classname = 8;</code> */ public java.lang.String getJavaOuterClassname() { return instance.getJavaOuterClassname(); } /**
private static String[] getFullyQualifiedClassName(Descriptors.Descriptor container, final FileOptions fileOpts, String name) { if (fileOpts.getJavaMultipleFiles()) { LinkedList<String> fqnSegments = new LinkedList<>(); fqnSegments.push(name); while (container != null) { fqnSegments.push(container.getName()); container = container.getContainingType(); } fqnSegments.push(fileOpts.getJavaPackage()); return fqnSegments.toArray(new String[] {}); } return new String[] {fileOpts.getJavaPackage(), fileOpts.getJavaOuterClassname(), name}; }
private static String getProtoElementPackage(ProtoElement elem) { String name = getJavaPackage(elem.getFile()); if (!elem.getFile().getProto().getOptions().getJavaMultipleFiles()) { String outerClassName = elem.getFile().getProto().getOptions().getJavaOuterClassname(); if (outerClassName.isEmpty()) { outerClassName = getFileClassName(elem.getFile()); } name = name + "." + outerClassName; } return name; }
private static String getFileImmutableClassName(FileDescriptorProto file) { if (file.getOptions().hasJavaOuterClassname()) { return file.getOptions().getJavaOuterClassname(); } String className = getFileDefaultImmutableClassName(file); if (hasConflictingClassName(file, className)) { return className + "OuterClass"; } return className; }
private static String getFileImmutableClassName(FileDescriptorProto file) { if (file.getOptions().hasJavaOuterClassname()) { return file.getOptions().getJavaOuterClassname(); } String className = getFileDefaultImmutableClassName(file); if (hasConflictingClassName(file, className)) { return className + "OuterClass"; } return className; }
result = result && getJavaOuterClassname() .equals(other.getJavaOuterClassname());
/** * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> * * <code>optional string java_outer_classname = 8;</code> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**
/** * <code>optional string java_outer_classname = 8;</code> * * <pre> * If set, all the classes from the .proto file are wrapped in a single * outer class with the given name. This applies to both Proto1 * (equivalent to the old "--one_java_file" option) and Proto2 (where * a .proto always translates to a single class, but you may want to * explicitly choose the class name). * </pre> */ public Builder clearJavaOuterClassname() { bitField0_ = (bitField0_ & ~0x00000002); javaOuterClassname_ = getDefaultInstance().getJavaOuterClassname(); onChanged(); return this; } /**