Expose JavaPackageDirectory and FileClassName in java/names.h

PiperOrigin-RevId: 631870244
pull/16661/head
Protobuf Team Bot 7 months ago committed by Copybara-Service
parent d5b7d7a87f
commit 64580b29c1
  1. 3
      src/google/protobuf/compiler/java/helpers.h
  2. 8
      src/google/protobuf/compiler/java/names.cc
  3. 14
      src/google/protobuf/compiler/java/names.h

@ -78,8 +78,7 @@ std::string UniqueFileScopeIdentifier(const Descriptor* descriptor);
// Gets the unqualified class name for the file. For each .proto file, there
// will be one Java class containing all the immutable messages and another
// Java class containing all the mutable messages.
// TODO: remove the default value after updating client code.
std::string FileClassName(const FileDescriptor* file, bool immutable = true);
std::string FileClassName(const FileDescriptor* file, bool immutable);
// Returns the file's Java package name.
std::string FileJavaPackage(const FileDescriptor* file, bool immutable,

@ -141,6 +141,14 @@ std::string FileJavaPackage(const FileDescriptor* file, Options options) {
return FileJavaPackage(file, true /* immutable */, options);
}
std::string JavaPackageDirectory(const FileDescriptor* file) {
return JavaPackageToDir(FileJavaPackage(file));
}
std::string FileClassName(const FileDescriptor* file) {
return FileClassName(file, /*immutable=*/true);
}
std::string CapitalizedFieldName(const FieldDescriptor* field) {
return UnderscoresToCamelCase(FieldName(field), true);
}

@ -72,6 +72,20 @@ std::string ClassName(const ServiceDescriptor* descriptor);
std::string FileJavaPackage(const FileDescriptor* descriptor,
Options options = {});
// Requires:
// descriptor != NULL
//
// Returns:
// Java package directory.
std::string JavaPackageDirectory(const FileDescriptor* file);
// Requires:
// descriptor != NULL
//
// Returns:
// The unqualified Java class name.
std::string FileClassName(const FileDescriptor* file);
// Requires:
// descriptor != NULL
// Returns:

Loading…
Cancel
Save