Initial check-in for message oneof.
This commit is contained in:
parent
33222b5a02
commit
7794a98ff4
@ -111,6 +111,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator(const FieldDescriptor* field,
|
||||
} else if (field->containing_oneof()) {
|
||||
switch (java_type) {
|
||||
case JAVATYPE_MESSAGE:
|
||||
return new MessageOneofFieldGenerator(field, params);
|
||||
case JAVATYPE_ENUM:
|
||||
default:
|
||||
return new PrimitiveOneofFieldGenerator(field, params);
|
||||
|
@ -146,12 +146,22 @@ GenerateHashCodeCode(io::Printer* printer) const {
|
||||
"result = 31 * result +\n"
|
||||
" (this.$name$ == null ? 0 : this.$name$.hashCode());\n");
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
MessageOneofFieldGenerator::MessageOneofFieldGenerator(
|
||||
const FieldDescriptor* descriptor, const Params& params)
|
||||
: FieldGenerator(params), descriptor_(descriptor) {
|
||||
SetMessageVariables(params, descriptor, &variables_);
|
||||
SetCommonOneofVariables(descriptor, &variables_);
|
||||
}
|
||||
|
||||
MessageOneofFieldGenerator::~MessageOneofFieldGenerator() {}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
RepeatedMessageFieldGenerator::
|
||||
RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, const Params& params)
|
||||
: FieldGenerator(params), descriptor_(descriptor) {
|
||||
RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
|
||||
const FieldDescriptor* descriptor, const Params& params)
|
||||
: FieldGenerator(params), descriptor_(descriptor) {
|
||||
SetMessageVariables(params, descriptor, &variables_);
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,20 @@ class MessageFieldGenerator : public FieldGenerator {
|
||||
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
|
||||
};
|
||||
|
||||
class MessageOneofFieldGenerator : public FieldGenerator {
|
||||
public:
|
||||
explicit MessageOneofFieldGenerator(const FieldDescriptor* descriptor,
|
||||
const Params& params);
|
||||
~MessageOneofFieldGenerator();
|
||||
|
||||
// implements FieldGenerator ---------------------------------------
|
||||
private:
|
||||
const FieldDescriptor* descriptor_;
|
||||
map<string, string> variables_;
|
||||
|
||||
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
|
||||
};
|
||||
|
||||
class RepeatedMessageFieldGenerator : public FieldGenerator {
|
||||
public:
|
||||
explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
|
||||
|
Loading…
Reference in New Issue
Block a user