From 8b0f93dfca48a1834affe6a4ff8b099a540b69c2 Mon Sep 17 00:00:00 2001 From: AfzalSM Date: Sun, 31 Jul 2016 23:32:32 +0530 Subject: [PATCH] include declared fields of domain subclasses while converting --- .../badata/protobuf/converter/Converter.java | 22 +- .../ConverterIncludeSubClassFieldsTest.java | 29 + .../protobuf/converter/domain/Coffee.java | 29 + .../protobuf/converter/domain/Liquid.java | 27 + .../protobuf/converter/proto/LiquidProto.java | 605 ++++++++++++++++++ ...converter_includesubclassfields_test.proto | 13 + 6 files changed, 719 insertions(+), 6 deletions(-) create mode 100644 src/test/java/net/badata/protobuf/converter/ConverterIncludeSubClassFieldsTest.java create mode 100644 src/test/java/net/badata/protobuf/converter/domain/Coffee.java create mode 100644 src/test/java/net/badata/protobuf/converter/domain/Liquid.java create mode 100644 src/test/java/net/badata/protobuf/converter/proto/LiquidProto.java create mode 100644 src/test/proto/converter_includesubclassfields_test.proto diff --git a/src/main/java/net/badata/protobuf/converter/Converter.java b/src/main/java/net/badata/protobuf/converter/Converter.java index 9522816..228cc51 100644 --- a/src/main/java/net/badata/protobuf/converter/Converter.java +++ b/src/main/java/net/badata/protobuf/converter/Converter.java @@ -35,10 +35,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; +import java.util.*; /** * Converts data from Protobuf messages to domain model objects and vice versa. @@ -154,7 +151,7 @@ private void fillDomain(final Object domain, final E protobu Class domainClass = domain.getClass(); Mapper fieldMapper = AnnotationUtils.createMapper(protoClassAnnotation); FieldResolverFactory fieldFactory = AnnotationUtils.createFieldFactory(protoClassAnnotation); - for (Field field : domainClass.getDeclaredFields()) { + for (Field field : getAllFields(domainClass)) { if (fieldsIgnore.ignored(field)) { continue; } @@ -258,7 +255,7 @@ private void fillProtobuf(final E protobuf, final Ob Class domainClass = domain.getClass(); Mapper fieldMapper = AnnotationUtils.createMapper(protoClassAnnotation); FieldResolverFactory fieldFactory = AnnotationUtils.createFieldFactory(protoClassAnnotation); - for (Field field : domainClass.getDeclaredFields()) { + for (Field field : getAllFields(domainClass)) { if (fieldsIgnore.ignored(field)) { continue; } @@ -267,6 +264,19 @@ private void fillProtobuf(final E protobuf, final Ob } } + private List getAllFields(Class clazz) { + List fields = new ArrayList(); + + fields.addAll(Arrays.asList(clazz.getDeclaredFields())); + + Class superClazz = clazz.getSuperclass(); + if(superClazz != null){ + fields.addAll( getAllFields(superClazz) ); + } + + return fields; + } + private void fillProtobufField(final FieldResolver fieldResolver, final MappingResult mappingResult) throws WriteException { ProtobufWriter fieldWriter = new ProtobufWriter((Message.Builder) mappingResult.getDestination()); diff --git a/src/test/java/net/badata/protobuf/converter/ConverterIncludeSubClassFieldsTest.java b/src/test/java/net/badata/protobuf/converter/ConverterIncludeSubClassFieldsTest.java new file mode 100644 index 0000000..4a302de --- /dev/null +++ b/src/test/java/net/badata/protobuf/converter/ConverterIncludeSubClassFieldsTest.java @@ -0,0 +1,29 @@ +package net.badata.protobuf.converter; + + +import net.badata.protobuf.converter.domain.Coffee; +import net.badata.protobuf.converter.proto.LiquidProto; +import org.junit.Test; + +import static junit.framework.Assert.assertEquals; + + +public class ConverterIncludeSubClassFieldsTest { + + @Test + public void testDomainToProtobuf() { + Coffee coffee = new Coffee(); + coffee.setMlVolume(100); + coffee.setTemperature(40); + coffee.setSwirling(true); + coffee.setClockwise(false); + + LiquidProto.Coffee coffeeProto = Converter.create().toProtobuf(LiquidProto.Coffee.class,coffee); + + assertEquals(coffee.getMlVolume(), coffeeProto.getMlVolume()); + assertEquals(coffee.getTemperature(), coffeeProto.getTemperature()); + assertEquals(coffee.isSwirling(),coffeeProto.getSwirling()); + assertEquals(coffee.isClockwise(), coffeeProto.getClockwise()); + + } +} diff --git a/src/test/java/net/badata/protobuf/converter/domain/Coffee.java b/src/test/java/net/badata/protobuf/converter/domain/Coffee.java new file mode 100644 index 0000000..462809d --- /dev/null +++ b/src/test/java/net/badata/protobuf/converter/domain/Coffee.java @@ -0,0 +1,29 @@ +package net.badata.protobuf.converter.domain; + +import net.badata.protobuf.converter.annotation.ProtoClass; +import net.badata.protobuf.converter.annotation.ProtoField; +import net.badata.protobuf.converter.proto.LiquidProto; + +@ProtoClass(LiquidProto.Coffee.class) +public class Coffee extends Liquid { + @ProtoField + private boolean swirling; + @ProtoField + private boolean clockwise; + + public boolean isSwirling() { + return swirling; + } + + public void setSwirling(boolean swirling) { + this.swirling = swirling; + } + + public boolean isClockwise() { + return clockwise; + } + + public void setClockwise(boolean clockwise) { + this.clockwise = clockwise; + } +} diff --git a/src/test/java/net/badata/protobuf/converter/domain/Liquid.java b/src/test/java/net/badata/protobuf/converter/domain/Liquid.java new file mode 100644 index 0000000..6665268 --- /dev/null +++ b/src/test/java/net/badata/protobuf/converter/domain/Liquid.java @@ -0,0 +1,27 @@ +package net.badata.protobuf.converter.domain; + + +import net.badata.protobuf.converter.annotation.ProtoField; + +public class Liquid { + @ProtoField + private int mlVolume; + @ProtoField + private float temperature; + + public int getMlVolume() { + return mlVolume; + } + + public void setMlVolume(int mlVolume) { + this.mlVolume = mlVolume; + } + + public float getTemperature() { + return temperature; + } + + public void setTemperature(float temperature) { + this.temperature = temperature; + } +} diff --git a/src/test/java/net/badata/protobuf/converter/proto/LiquidProto.java b/src/test/java/net/badata/protobuf/converter/proto/LiquidProto.java new file mode 100644 index 0000000..fcc8ba8 --- /dev/null +++ b/src/test/java/net/badata/protobuf/converter/proto/LiquidProto.java @@ -0,0 +1,605 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: converter_includesubclassfields_test.proto + +package net.badata.protobuf.converter.proto; + +public final class LiquidProto { + private LiquidProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface CoffeeOrBuilder extends + // @@protoc_insertion_point(interface_extends:net.badata.protobuf.converter.proto.Coffee) + com.google.protobuf.MessageOrBuilder { + + /** + * optional int32 mlVolume = 1; + */ + int getMlVolume(); + + /** + * optional float temperature = 2; + */ + float getTemperature(); + + /** + * optional bool swirling = 3; + */ + boolean getSwirling(); + + /** + * optional bool clockwise = 4; + */ + boolean getClockwise(); + } + /** + * Protobuf type {@code net.badata.protobuf.converter.proto.Coffee} + */ + public static final class Coffee extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:net.badata.protobuf.converter.proto.Coffee) + CoffeeOrBuilder { + // Use Coffee.newBuilder() to construct. + private Coffee(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Coffee() { + mlVolume_ = 0; + temperature_ = 0F; + swirling_ = false; + clockwise_ = false; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + private Coffee( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) { + this(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!input.skipField(tag)) { + done = true; + } + break; + } + case 8: { + + mlVolume_ = input.readInt32(); + break; + } + case 21: { + + temperature_ = input.readFloat(); + break; + } + case 24: { + + swirling_ = input.readBool(); + break; + } + case 32: { + + clockwise_ = input.readBool(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw new RuntimeException(e.setUnfinishedMessage(this)); + } catch (java.io.IOException e) { + throw new RuntimeException( + new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this)); + } finally { + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.badata.protobuf.converter.proto.LiquidProto.internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.badata.protobuf.converter.proto.LiquidProto.internal_static_net_badata_protobuf_converter_proto_Coffee_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.badata.protobuf.converter.proto.LiquidProto.Coffee.class, net.badata.protobuf.converter.proto.LiquidProto.Coffee.Builder.class); + } + + public static final int MLVOLUME_FIELD_NUMBER = 1; + private int mlVolume_; + /** + * optional int32 mlVolume = 1; + */ + public int getMlVolume() { + return mlVolume_; + } + + public static final int TEMPERATURE_FIELD_NUMBER = 2; + private float temperature_; + /** + * optional float temperature = 2; + */ + public float getTemperature() { + return temperature_; + } + + public static final int SWIRLING_FIELD_NUMBER = 3; + private boolean swirling_; + /** + * optional bool swirling = 3; + */ + public boolean getSwirling() { + return swirling_; + } + + public static final int CLOCKWISE_FIELD_NUMBER = 4; + private boolean clockwise_; + /** + * optional bool clockwise = 4; + */ + public boolean getClockwise() { + return clockwise_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (mlVolume_ != 0) { + output.writeInt32(1, mlVolume_); + } + if (temperature_ != 0F) { + output.writeFloat(2, temperature_); + } + if (swirling_ != false) { + output.writeBool(3, swirling_); + } + if (clockwise_ != false) { + output.writeBool(4, clockwise_); + } + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (mlVolume_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, mlVolume_); + } + if (temperature_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(2, temperature_); + } + if (swirling_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, swirling_); + } + if (clockwise_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, clockwise_); + } + memoizedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.badata.protobuf.converter.proto.LiquidProto.Coffee prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code net.badata.protobuf.converter.proto.Coffee} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:net.badata.protobuf.converter.proto.Coffee) + net.badata.protobuf.converter.proto.LiquidProto.CoffeeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.badata.protobuf.converter.proto.LiquidProto.internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.badata.protobuf.converter.proto.LiquidProto.internal_static_net_badata_protobuf_converter_proto_Coffee_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.badata.protobuf.converter.proto.LiquidProto.Coffee.class, net.badata.protobuf.converter.proto.LiquidProto.Coffee.Builder.class); + } + + // Construct using net.badata.protobuf.converter.proto.LiquidProto.Coffee.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + mlVolume_ = 0; + + temperature_ = 0F; + + swirling_ = false; + + clockwise_ = false; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.badata.protobuf.converter.proto.LiquidProto.internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor; + } + + public net.badata.protobuf.converter.proto.LiquidProto.Coffee getDefaultInstanceForType() { + return net.badata.protobuf.converter.proto.LiquidProto.Coffee.getDefaultInstance(); + } + + public net.badata.protobuf.converter.proto.LiquidProto.Coffee build() { + net.badata.protobuf.converter.proto.LiquidProto.Coffee result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public net.badata.protobuf.converter.proto.LiquidProto.Coffee buildPartial() { + net.badata.protobuf.converter.proto.LiquidProto.Coffee result = new net.badata.protobuf.converter.proto.LiquidProto.Coffee(this); + result.mlVolume_ = mlVolume_; + result.temperature_ = temperature_; + result.swirling_ = swirling_; + result.clockwise_ = clockwise_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.badata.protobuf.converter.proto.LiquidProto.Coffee) { + return mergeFrom((net.badata.protobuf.converter.proto.LiquidProto.Coffee)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.badata.protobuf.converter.proto.LiquidProto.Coffee other) { + if (other == net.badata.protobuf.converter.proto.LiquidProto.Coffee.getDefaultInstance()) return this; + if (other.getMlVolume() != 0) { + setMlVolume(other.getMlVolume()); + } + if (other.getTemperature() != 0F) { + setTemperature(other.getTemperature()); + } + if (other.getSwirling() != false) { + setSwirling(other.getSwirling()); + } + if (other.getClockwise() != false) { + setClockwise(other.getClockwise()); + } + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + net.badata.protobuf.converter.proto.LiquidProto.Coffee parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (net.badata.protobuf.converter.proto.LiquidProto.Coffee) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int mlVolume_ ; + /** + * optional int32 mlVolume = 1; + */ + public int getMlVolume() { + return mlVolume_; + } + /** + * optional int32 mlVolume = 1; + */ + public Builder setMlVolume(int value) { + + mlVolume_ = value; + onChanged(); + return this; + } + /** + * optional int32 mlVolume = 1; + */ + public Builder clearMlVolume() { + + mlVolume_ = 0; + onChanged(); + return this; + } + + private float temperature_ ; + /** + * optional float temperature = 2; + */ + public float getTemperature() { + return temperature_; + } + /** + * optional float temperature = 2; + */ + public Builder setTemperature(float value) { + + temperature_ = value; + onChanged(); + return this; + } + /** + * optional float temperature = 2; + */ + public Builder clearTemperature() { + + temperature_ = 0F; + onChanged(); + return this; + } + + private boolean swirling_ ; + /** + * optional bool swirling = 3; + */ + public boolean getSwirling() { + return swirling_; + } + /** + * optional bool swirling = 3; + */ + public Builder setSwirling(boolean value) { + + swirling_ = value; + onChanged(); + return this; + } + /** + * optional bool swirling = 3; + */ + public Builder clearSwirling() { + + swirling_ = false; + onChanged(); + return this; + } + + private boolean clockwise_ ; + /** + * optional bool clockwise = 4; + */ + public boolean getClockwise() { + return clockwise_; + } + /** + * optional bool clockwise = 4; + */ + public Builder setClockwise(boolean value) { + + clockwise_ = value; + onChanged(); + return this; + } + /** + * optional bool clockwise = 4; + */ + public Builder clearClockwise() { + + clockwise_ = false; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return this; + } + + + // @@protoc_insertion_point(builder_scope:net.badata.protobuf.converter.proto.Coffee) + } + + // @@protoc_insertion_point(class_scope:net.badata.protobuf.converter.proto.Coffee) + private static final net.badata.protobuf.converter.proto.LiquidProto.Coffee DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.badata.protobuf.converter.proto.LiquidProto.Coffee(); + } + + public static net.badata.protobuf.converter.proto.LiquidProto.Coffee getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public Coffee parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + try { + return new Coffee(input, extensionRegistry); + } catch (RuntimeException e) { + if (e.getCause() instanceof + com.google.protobuf.InvalidProtocolBufferException) { + throw (com.google.protobuf.InvalidProtocolBufferException) + e.getCause(); + } + throw e; + } + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public net.badata.protobuf.converter.proto.LiquidProto.Coffee getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_net_badata_protobuf_converter_proto_Coffee_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n*converter_includesubclassfields_test.p" + + "roto\022#net.badata.protobuf.converter.prot" + + "o\"T\n\006Coffee\022\020\n\010mlVolume\030\001 \001(\005\022\023\n\013tempera" + + "ture\030\002 \001(\002\022\020\n\010swirling\030\003 \001(\010\022\021\n\tclockwis" + + "e\030\004 \001(\010B2\n#net.badata.protobuf.converter" + + ".protoB\013LiquidProtob\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_net_badata_protobuf_converter_proto_Coffee_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_net_badata_protobuf_converter_proto_Coffee_descriptor, + new java.lang.String[] { "MlVolume", "Temperature", "Swirling", "Clockwise", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/test/proto/converter_includesubclassfields_test.proto b/src/test/proto/converter_includesubclassfields_test.proto new file mode 100644 index 0000000..4060bda --- /dev/null +++ b/src/test/proto/converter_includesubclassfields_test.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package net.badata.protobuf.converter.proto; + +option java_package = "net.badata.protobuf.converter.proto"; +option java_outer_classname = "LiquidProto"; + +message Coffee{ + int32 mlVolume = 1; + float temperature = 2; + bool swirling = 3; + bool clockwise = 4; +}