Go to the documentation of this file.
31 #include <google/protobuf/compiler/java/java_context.h>
33 #include <google/protobuf/compiler/java/java_field.h>
34 #include <google/protobuf/compiler/java/java_helpers.h>
35 #include <google/protobuf/compiler/java/java_name_resolver.h>
36 #include <google/protobuf/descriptor.h>
37 #include <google/protobuf/stubs/strutil.h>
38 #include <google/protobuf/stubs/map_util.h>
63 if (field1->is_repeated()) {
64 if (field2->is_repeated()) {
69 if (name1 +
"Count" == name2) {
70 *info =
"both repeated field \"" + field1->name() +
"\" and singular " +
71 "field \"" + field2->name() +
"\" generate the method \"" +
72 "get" + name1 +
"Count()\"";
75 if (name1 +
"List" == name2) {
76 *info =
"both repeated field \"" + field1->name() +
"\" and singular " +
77 "field \"" + field2->name() +
"\" generate the method \"" +
78 "get" + name1 +
"List()\"";
89 if (field2->is_repeated()) {
90 return IsConflicting(field2, name2, field1, name1, info);
100 for (
int i = 0;
i <
file->message_type_count(); ++
i) {
107 for (
int i = 0;
i <
message->nested_type_count(); ++
i) {
110 std::vector<const FieldDescriptor*>
fields;
112 for (
int i = 0;
i <
message->field_count(); ++
i) {
117 for (
int i = 0;
i <
message->oneof_decl_count(); ++
i) {
119 OneofGeneratorInfo info;
127 const std::vector<const FieldDescriptor*>&
fields) {
130 std::vector<bool> is_conflict(
fields.size());
131 std::vector<std::string> conflict_reason(
fields.size());
132 for (
int i = 0;
i <
fields.size(); ++
i) {
135 for (
int j = i + 1;
j <
fields.size(); ++
j) {
138 if (
name == other_name) {
139 is_conflict[
i] = is_conflict[
j] =
true;
140 conflict_reason[
i] = conflict_reason[
j] =
141 "capitalized name of field \"" +
field->name() +
142 "\" conflicts with field \"" + other->name() +
"\"";
143 }
else if (IsConflicting(
field,
name, other, other_name,
144 &conflict_reason[j])) {
145 is_conflict[
i] = is_conflict[
j] =
true;
146 conflict_reason[
i] = conflict_reason[
j];
149 if (is_conflict[i]) {
151 <<
"with another field: " << conflict_reason[
i];
154 for (
int i = 0;
i <
fields.size(); ++
i) {
156 FieldGeneratorInfo info;
161 if (is_conflict[i]) {
164 info.disambiguated_reason = conflict_reason[
i];
172 const FieldGeneratorInfo*
result =
176 <<
field->full_name();
183 const OneofGeneratorInfo*
result =
std::string UnderscoresToCamelCase(const std::string &input, bool cap_next_letter)
void InitializeFieldGeneratorInfoForFields(const std::vector< const FieldDescriptor * > &fields)
std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor *field)
string StrCat(const AlphaNum &a, const AlphaNum &b)
std::string CamelCaseFieldName(const FieldDescriptor *field)
const FieldGeneratorInfo * GetFieldGeneratorInfo(const FieldDescriptor *field) const
static const LogLevel WARNING
void InitializeFieldGeneratorInfo(const FileDescriptor *file)
Context(const FileDescriptor *file, const Options &options)
bool HasGeneratedMethods(const Descriptor *descriptor) const
std::unique_ptr< ClassNameResolver > name_resolver_
const FieldDescriptor * field
void InitializeFieldGeneratorInfoForMessage(const Descriptor *message)
DebugStringOptions options_
std::map< const OneofDescriptor *, OneofGeneratorInfo > oneof_generator_info_map_
std::map< const FieldDescriptor *, FieldGeneratorInfo > field_generator_info_map_
ClassNameResolver * GetNameResolver() const
const OneofGeneratorInfo * GetOneofGeneratorInfo(const OneofDescriptor *oneof) const
#define GOOGLE_LOG(LEVEL)
static const char descriptor[1336]
const Collection::value_type::second_type * FindOrNull(const Collection &collection, const typename Collection::value_type::first_type &key)
static constexpr OptimizeMode CODE_SIZE
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:08