You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2011/10/05 23:17:32 UTC
svn commit: r1179443 - in /avro/trunk: ./ lang/java/protobuf/
lang/java/protobuf/src/test/java/org/apache/avro/protobuf/
lang/java/protobuf/src/test/protobuf/ lang/java/thrift/src/test/thrift/
share/
Author: cutting
Date: Wed Oct 5 21:17:31 2011
New Revision: 1179443
URL: http://svn.apache.org/viewvc?rev=1179443&view=rev
Log:
AVRO-910. Java: Add generated protobuf test code to subversion.
Added:
avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/java/protobuf/pom.xml
avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java
avro/trunk/lang/java/protobuf/src/test/protobuf/test.proto
avro/trunk/lang/java/thrift/src/test/thrift/test.thrift
avro/trunk/share/rat-excludes.txt
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Oct 5 21:17:31 2011
@@ -100,6 +100,8 @@ Avro 1.6.0 (unreleased)
AVRO-905. Java: Change JsonEncoder to write objects on separate
lines. (cutting)
+ AVRO-910. Java: Add generated protobuf test code to subversion. (cutting)
+
BUG FIXES
AVRO-824. Java: Fix usage message of BinaryFragmentToJsonTool.
Modified: avro/trunk/lang/java/protobuf/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/pom.xml?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/pom.xml (original)
+++ avro/trunk/lang/java/protobuf/pom.xml Wed Oct 5 21:17:31 2011
@@ -43,31 +43,34 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-test-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <mkdir dir="target/generated-test-sources"/>
- <exec executable="protoc">
- <arg value="--java_out=target/generated-test-sources"/>
- <arg value="src/test/protobuf/test.proto"/>
- </exec>
- </tasks>
- <sourceRoot>target/generated-test-sources</sourceRoot>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <profiles>
+ <profile>
+ <id>protobuf-generate</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="target/protobuf-tmp" />
+ <exec executable="protoc">
+ <arg value="--java_out=src/test/java/"/>
+ <arg value="src/test/protobuf/test.proto"/>
+ </exec>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Added: avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java?rev=1179443&view=auto
==============================================================================
--- avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java (added)
+++ avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java Wed Oct 5 21:17:31 2011
@@ -0,0 +1,1648 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: src/test/protobuf/test.proto
+
+package org.apache.avro.protobuf;
+
+public final class Test {
+ private Test() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public enum A
+ implements com.google.protobuf.ProtocolMessageEnum {
+ X(0, 1),
+ Y(1, 2),
+ Z(2, 3),
+ ;
+
+ public static final int X_VALUE = 1;
+ public static final int Y_VALUE = 2;
+ public static final int Z_VALUE = 3;
+
+
+ public final int getNumber() { return value; }
+
+ public static A valueOf(int value) {
+ switch (value) {
+ case 1: return X;
+ case 2: return Y;
+ case 3: return Z;
+ default: return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap<A>
+ internalGetValueMap() {
+ return internalValueMap;
+ }
+ private static com.google.protobuf.Internal.EnumLiteMap<A>
+ internalValueMap =
+ new com.google.protobuf.Internal.EnumLiteMap<A>() {
+ public A findValueByNumber(int number) {
+ return A.valueOf(number);
+ }
+ };
+
+ public final com.google.protobuf.Descriptors.EnumValueDescriptor
+ getValueDescriptor() {
+ return getDescriptor().getValues().get(index);
+ }
+ public final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptorForType() {
+ return getDescriptor();
+ }
+ public static final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptor() {
+ return org.apache.avro.protobuf.Test.getDescriptor().getEnumTypes().get(0);
+ }
+
+ private static final A[] VALUES = {
+ X, Y, Z,
+ };
+
+ public static A valueOf(
+ com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+ if (desc.getType() != getDescriptor()) {
+ throw new java.lang.IllegalArgumentException(
+ "EnumValueDescriptor is not for this type.");
+ }
+ return VALUES[desc.getIndex()];
+ }
+
+ private final int index;
+ private final int value;
+
+ private A(int index, int value) {
+ this.index = index;
+ this.value = value;
+ }
+
+ // @@protoc_insertion_point(enum_scope:org.apache.avro.protobuf.A)
+ }
+
+ public interface FooOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required int32 int32 = 1;
+ boolean hasInt32();
+ int getInt32();
+
+ // optional int64 int64 = 2;
+ boolean hasInt64();
+ long getInt64();
+
+ // optional uint32 uint32 = 3;
+ boolean hasUint32();
+ int getUint32();
+
+ // optional uint64 uint64 = 4;
+ boolean hasUint64();
+ long getUint64();
+
+ // optional sint32 sint32 = 5;
+ boolean hasSint32();
+ int getSint32();
+
+ // optional sint64 sint64 = 6;
+ boolean hasSint64();
+ long getSint64();
+
+ // optional fixed32 fixed32 = 7;
+ boolean hasFixed32();
+ int getFixed32();
+
+ // optional fixed64 fixed64 = 8;
+ boolean hasFixed64();
+ long getFixed64();
+
+ // optional sfixed32 sfixed32 = 9;
+ boolean hasSfixed32();
+ int getSfixed32();
+
+ // optional sfixed64 sfixed64 = 10;
+ boolean hasSfixed64();
+ long getSfixed64();
+
+ // optional float float = 11;
+ boolean hasFloat();
+ float getFloat();
+
+ // optional double double = 12;
+ boolean hasDouble();
+ double getDouble();
+
+ // optional bool bool = 13;
+ boolean hasBool();
+ boolean getBool();
+
+ // optional string string = 14;
+ boolean hasString();
+ java.lang.String getString();
+
+ // optional bytes bytes = 15;
+ boolean hasBytes();
+ com.google.protobuf.ByteString getBytes();
+
+ // optional .org.apache.avro.protobuf.A enum = 16;
+ boolean hasEnum();
+ org.apache.avro.protobuf.Test.A getEnum();
+
+ // repeated int32 intArray = 17;
+ java.util.List<java.lang.Integer> getIntArrayList();
+ int getIntArrayCount();
+ int getIntArray(int index);
+
+ // optional .org.apache.avro.protobuf.Foo foo = 18;
+ boolean hasFoo();
+ org.apache.avro.protobuf.Test.Foo getFoo();
+ org.apache.avro.protobuf.Test.FooOrBuilder getFooOrBuilder();
+ }
+ public static final class Foo extends
+ com.google.protobuf.GeneratedMessage
+ implements FooOrBuilder {
+ // Use Foo.newBuilder() to construct.
+ private Foo(Builder builder) {
+ super(builder);
+ }
+ private Foo(boolean noInit) {}
+
+ private static final Foo defaultInstance;
+ public static Foo getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Foo getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.avro.protobuf.Test.internal_static_org_apache_avro_protobuf_Foo_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.avro.protobuf.Test.internal_static_org_apache_avro_protobuf_Foo_fieldAccessorTable;
+ }
+
+ private int bitField0_;
+ // required int32 int32 = 1;
+ public static final int INT32_FIELD_NUMBER = 1;
+ private int int32_;
+ public boolean hasInt32() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public int getInt32() {
+ return int32_;
+ }
+
+ // optional int64 int64 = 2;
+ public static final int INT64_FIELD_NUMBER = 2;
+ private long int64_;
+ public boolean hasInt64() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public long getInt64() {
+ return int64_;
+ }
+
+ // optional uint32 uint32 = 3;
+ public static final int UINT32_FIELD_NUMBER = 3;
+ private int uint32_;
+ public boolean hasUint32() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ public int getUint32() {
+ return uint32_;
+ }
+
+ // optional uint64 uint64 = 4;
+ public static final int UINT64_FIELD_NUMBER = 4;
+ private long uint64_;
+ public boolean hasUint64() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ public long getUint64() {
+ return uint64_;
+ }
+
+ // optional sint32 sint32 = 5;
+ public static final int SINT32_FIELD_NUMBER = 5;
+ private int sint32_;
+ public boolean hasSint32() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ public int getSint32() {
+ return sint32_;
+ }
+
+ // optional sint64 sint64 = 6;
+ public static final int SINT64_FIELD_NUMBER = 6;
+ private long sint64_;
+ public boolean hasSint64() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ public long getSint64() {
+ return sint64_;
+ }
+
+ // optional fixed32 fixed32 = 7;
+ public static final int FIXED32_FIELD_NUMBER = 7;
+ private int fixed32_;
+ public boolean hasFixed32() {
+ return ((bitField0_ & 0x00000040) == 0x00000040);
+ }
+ public int getFixed32() {
+ return fixed32_;
+ }
+
+ // optional fixed64 fixed64 = 8;
+ public static final int FIXED64_FIELD_NUMBER = 8;
+ private long fixed64_;
+ public boolean hasFixed64() {
+ return ((bitField0_ & 0x00000080) == 0x00000080);
+ }
+ public long getFixed64() {
+ return fixed64_;
+ }
+
+ // optional sfixed32 sfixed32 = 9;
+ public static final int SFIXED32_FIELD_NUMBER = 9;
+ private int sfixed32_;
+ public boolean hasSfixed32() {
+ return ((bitField0_ & 0x00000100) == 0x00000100);
+ }
+ public int getSfixed32() {
+ return sfixed32_;
+ }
+
+ // optional sfixed64 sfixed64 = 10;
+ public static final int SFIXED64_FIELD_NUMBER = 10;
+ private long sfixed64_;
+ public boolean hasSfixed64() {
+ return ((bitField0_ & 0x00000200) == 0x00000200);
+ }
+ public long getSfixed64() {
+ return sfixed64_;
+ }
+
+ // optional float float = 11;
+ public static final int FLOAT_FIELD_NUMBER = 11;
+ private float float_;
+ public boolean hasFloat() {
+ return ((bitField0_ & 0x00000400) == 0x00000400);
+ }
+ public float getFloat() {
+ return float_;
+ }
+
+ // optional double double = 12;
+ public static final int DOUBLE_FIELD_NUMBER = 12;
+ private double double_;
+ public boolean hasDouble() {
+ return ((bitField0_ & 0x00000800) == 0x00000800);
+ }
+ public double getDouble() {
+ return double_;
+ }
+
+ // optional bool bool = 13;
+ public static final int BOOL_FIELD_NUMBER = 13;
+ private boolean bool_;
+ public boolean hasBool() {
+ return ((bitField0_ & 0x00001000) == 0x00001000);
+ }
+ public boolean getBool() {
+ return bool_;
+ }
+
+ // optional string string = 14;
+ public static final int STRING_FIELD_NUMBER = 14;
+ private java.lang.Object string_;
+ public boolean hasString() {
+ return ((bitField0_ & 0x00002000) == 0x00002000);
+ }
+ public java.lang.String getString() {
+ java.lang.Object ref = string_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (com.google.protobuf.Internal.isValidUtf8(bs)) {
+ string_ = s;
+ }
+ return s;
+ }
+ }
+ private com.google.protobuf.ByteString getStringBytes() {
+ java.lang.Object ref = string_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ string_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional bytes bytes = 15;
+ public static final int BYTES_FIELD_NUMBER = 15;
+ private com.google.protobuf.ByteString bytes_;
+ public boolean hasBytes() {
+ return ((bitField0_ & 0x00004000) == 0x00004000);
+ }
+ public com.google.protobuf.ByteString getBytes() {
+ return bytes_;
+ }
+
+ // optional .org.apache.avro.protobuf.A enum = 16;
+ public static final int ENUM_FIELD_NUMBER = 16;
+ private org.apache.avro.protobuf.Test.A enum_;
+ public boolean hasEnum() {
+ return ((bitField0_ & 0x00008000) == 0x00008000);
+ }
+ public org.apache.avro.protobuf.Test.A getEnum() {
+ return enum_;
+ }
+
+ // repeated int32 intArray = 17;
+ public static final int INTARRAY_FIELD_NUMBER = 17;
+ private java.util.List<java.lang.Integer> intArray_;
+ public java.util.List<java.lang.Integer>
+ getIntArrayList() {
+ return intArray_;
+ }
+ public int getIntArrayCount() {
+ return intArray_.size();
+ }
+ public int getIntArray(int index) {
+ return intArray_.get(index);
+ }
+
+ // optional .org.apache.avro.protobuf.Foo foo = 18;
+ public static final int FOO_FIELD_NUMBER = 18;
+ private org.apache.avro.protobuf.Test.Foo foo_;
+ public boolean hasFoo() {
+ return ((bitField0_ & 0x00010000) == 0x00010000);
+ }
+ public org.apache.avro.protobuf.Test.Foo getFoo() {
+ return foo_;
+ }
+ public org.apache.avro.protobuf.Test.FooOrBuilder getFooOrBuilder() {
+ return foo_;
+ }
+
+ private void initFields() {
+ int32_ = 0;
+ int64_ = 0L;
+ uint32_ = 0;
+ uint64_ = 0L;
+ sint32_ = 0;
+ sint64_ = 0L;
+ fixed32_ = 0;
+ fixed64_ = 0L;
+ sfixed32_ = 0;
+ sfixed64_ = 0L;
+ float_ = 0F;
+ double_ = 0D;
+ bool_ = false;
+ string_ = "";
+ bytes_ = com.google.protobuf.ByteString.EMPTY;
+ enum_ = org.apache.avro.protobuf.Test.A.X;
+ intArray_ = java.util.Collections.emptyList();
+ foo_ = org.apache.avro.protobuf.Test.Foo.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasInt32()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (hasFoo()) {
+ if (!getFoo().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeInt32(1, int32_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeInt64(2, int64_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeUInt32(3, uint32_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeUInt64(4, uint64_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeSInt32(5, sint32_);
+ }
+ if (((bitField0_ & 0x00000020) == 0x00000020)) {
+ output.writeSInt64(6, sint64_);
+ }
+ if (((bitField0_ & 0x00000040) == 0x00000040)) {
+ output.writeFixed32(7, fixed32_);
+ }
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ output.writeFixed64(8, fixed64_);
+ }
+ if (((bitField0_ & 0x00000100) == 0x00000100)) {
+ output.writeSFixed32(9, sfixed32_);
+ }
+ if (((bitField0_ & 0x00000200) == 0x00000200)) {
+ output.writeSFixed64(10, sfixed64_);
+ }
+ if (((bitField0_ & 0x00000400) == 0x00000400)) {
+ output.writeFloat(11, float_);
+ }
+ if (((bitField0_ & 0x00000800) == 0x00000800)) {
+ output.writeDouble(12, double_);
+ }
+ if (((bitField0_ & 0x00001000) == 0x00001000)) {
+ output.writeBool(13, bool_);
+ }
+ if (((bitField0_ & 0x00002000) == 0x00002000)) {
+ output.writeBytes(14, getStringBytes());
+ }
+ if (((bitField0_ & 0x00004000) == 0x00004000)) {
+ output.writeBytes(15, bytes_);
+ }
+ if (((bitField0_ & 0x00008000) == 0x00008000)) {
+ output.writeEnum(16, enum_.getNumber());
+ }
+ for (int i = 0; i < intArray_.size(); i++) {
+ output.writeInt32(17, intArray_.get(i));
+ }
+ if (((bitField0_ & 0x00010000) == 0x00010000)) {
+ output.writeMessage(18, foo_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(1, int32_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(2, int64_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt32Size(3, uint32_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt64Size(4, uint64_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeSInt32Size(5, sint32_);
+ }
+ if (((bitField0_ & 0x00000020) == 0x00000020)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeSInt64Size(6, sint64_);
+ }
+ if (((bitField0_ & 0x00000040) == 0x00000040)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeFixed32Size(7, fixed32_);
+ }
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeFixed64Size(8, fixed64_);
+ }
+ if (((bitField0_ & 0x00000100) == 0x00000100)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeSFixed32Size(9, sfixed32_);
+ }
+ if (((bitField0_ & 0x00000200) == 0x00000200)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeSFixed64Size(10, sfixed64_);
+ }
+ if (((bitField0_ & 0x00000400) == 0x00000400)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeFloatSize(11, float_);
+ }
+ if (((bitField0_ & 0x00000800) == 0x00000800)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeDoubleSize(12, double_);
+ }
+ if (((bitField0_ & 0x00001000) == 0x00001000)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(13, bool_);
+ }
+ if (((bitField0_ & 0x00002000) == 0x00002000)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(14, getStringBytes());
+ }
+ if (((bitField0_ & 0x00004000) == 0x00004000)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(15, bytes_);
+ }
+ if (((bitField0_ & 0x00008000) == 0x00008000)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeEnumSize(16, enum_.getNumber());
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < intArray_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeInt32SizeNoTag(intArray_.get(i));
+ }
+ size += dataSize;
+ size += 2 * getIntArrayList().size();
+ }
+ if (((bitField0_ & 0x00010000) == 0x00010000)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(18, foo_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.avro.protobuf.Test.Foo parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.avro.protobuf.Test.Foo prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.avro.protobuf.Test.FooOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.avro.protobuf.Test.internal_static_org_apache_avro_protobuf_Foo_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.avro.protobuf.Test.internal_static_org_apache_avro_protobuf_Foo_fieldAccessorTable;
+ }
+
+ // Construct using org.apache.avro.protobuf.Test.Foo.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getFooFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ int32_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ int64_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ uint32_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ uint64_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ sint32_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ sint64_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ fixed32_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000040);
+ fixed64_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000080);
+ sfixed32_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000100);
+ sfixed64_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000200);
+ float_ = 0F;
+ bitField0_ = (bitField0_ & ~0x00000400);
+ double_ = 0D;
+ bitField0_ = (bitField0_ & ~0x00000800);
+ bool_ = false;
+ bitField0_ = (bitField0_ & ~0x00001000);
+ string_ = "";
+ bitField0_ = (bitField0_ & ~0x00002000);
+ bytes_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00004000);
+ enum_ = org.apache.avro.protobuf.Test.A.X;
+ bitField0_ = (bitField0_ & ~0x00008000);
+ intArray_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00010000);
+ if (fooBuilder_ == null) {
+ foo_ = org.apache.avro.protobuf.Test.Foo.getDefaultInstance();
+ } else {
+ fooBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00020000);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.avro.protobuf.Test.Foo.getDescriptor();
+ }
+
+ public org.apache.avro.protobuf.Test.Foo getDefaultInstanceForType() {
+ return org.apache.avro.protobuf.Test.Foo.getDefaultInstance();
+ }
+
+ public org.apache.avro.protobuf.Test.Foo build() {
+ org.apache.avro.protobuf.Test.Foo result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ private org.apache.avro.protobuf.Test.Foo buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ org.apache.avro.protobuf.Test.Foo result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return result;
+ }
+
+ public org.apache.avro.protobuf.Test.Foo buildPartial() {
+ org.apache.avro.protobuf.Test.Foo result = new org.apache.avro.protobuf.Test.Foo(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.int32_ = int32_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.int64_ = int64_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.uint32_ = uint32_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.uint64_ = uint64_;
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.sint32_ = sint32_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000020;
+ }
+ result.sint64_ = sint64_;
+ if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
+ to_bitField0_ |= 0x00000040;
+ }
+ result.fixed32_ = fixed32_;
+ if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+ to_bitField0_ |= 0x00000080;
+ }
+ result.fixed64_ = fixed64_;
+ if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
+ to_bitField0_ |= 0x00000100;
+ }
+ result.sfixed32_ = sfixed32_;
+ if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
+ to_bitField0_ |= 0x00000200;
+ }
+ result.sfixed64_ = sfixed64_;
+ if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
+ to_bitField0_ |= 0x00000400;
+ }
+ result.float_ = float_;
+ if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
+ to_bitField0_ |= 0x00000800;
+ }
+ result.double_ = double_;
+ if (((from_bitField0_ & 0x00001000) == 0x00001000)) {
+ to_bitField0_ |= 0x00001000;
+ }
+ result.bool_ = bool_;
+ if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
+ to_bitField0_ |= 0x00002000;
+ }
+ result.string_ = string_;
+ if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
+ to_bitField0_ |= 0x00004000;
+ }
+ result.bytes_ = bytes_;
+ if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
+ to_bitField0_ |= 0x00008000;
+ }
+ result.enum_ = enum_;
+ if (((bitField0_ & 0x00010000) == 0x00010000)) {
+ intArray_ = java.util.Collections.unmodifiableList(intArray_);
+ bitField0_ = (bitField0_ & ~0x00010000);
+ }
+ result.intArray_ = intArray_;
+ if (((from_bitField0_ & 0x00020000) == 0x00020000)) {
+ to_bitField0_ |= 0x00010000;
+ }
+ if (fooBuilder_ == null) {
+ result.foo_ = foo_;
+ } else {
+ result.foo_ = fooBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.avro.protobuf.Test.Foo) {
+ return mergeFrom((org.apache.avro.protobuf.Test.Foo)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.avro.protobuf.Test.Foo other) {
+ if (other == org.apache.avro.protobuf.Test.Foo.getDefaultInstance()) return this;
+ if (other.hasInt32()) {
+ setInt32(other.getInt32());
+ }
+ if (other.hasInt64()) {
+ setInt64(other.getInt64());
+ }
+ if (other.hasUint32()) {
+ setUint32(other.getUint32());
+ }
+ if (other.hasUint64()) {
+ setUint64(other.getUint64());
+ }
+ if (other.hasSint32()) {
+ setSint32(other.getSint32());
+ }
+ if (other.hasSint64()) {
+ setSint64(other.getSint64());
+ }
+ if (other.hasFixed32()) {
+ setFixed32(other.getFixed32());
+ }
+ if (other.hasFixed64()) {
+ setFixed64(other.getFixed64());
+ }
+ if (other.hasSfixed32()) {
+ setSfixed32(other.getSfixed32());
+ }
+ if (other.hasSfixed64()) {
+ setSfixed64(other.getSfixed64());
+ }
+ if (other.hasFloat()) {
+ setFloat(other.getFloat());
+ }
+ if (other.hasDouble()) {
+ setDouble(other.getDouble());
+ }
+ if (other.hasBool()) {
+ setBool(other.getBool());
+ }
+ if (other.hasString()) {
+ setString(other.getString());
+ }
+ if (other.hasBytes()) {
+ setBytes(other.getBytes());
+ }
+ if (other.hasEnum()) {
+ setEnum(other.getEnum());
+ }
+ if (!other.intArray_.isEmpty()) {
+ if (intArray_.isEmpty()) {
+ intArray_ = other.intArray_;
+ bitField0_ = (bitField0_ & ~0x00010000);
+ } else {
+ ensureIntArrayIsMutable();
+ intArray_.addAll(other.intArray_);
+ }
+ onChanged();
+ }
+ if (other.hasFoo()) {
+ mergeFoo(other.getFoo());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasInt32()) {
+
+ return false;
+ }
+ if (hasFoo()) {
+ if (!getFoo().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder(
+ this.getUnknownFields());
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ int32_ = input.readInt32();
+ break;
+ }
+ case 16: {
+ bitField0_ |= 0x00000002;
+ int64_ = input.readInt64();
+ break;
+ }
+ case 24: {
+ bitField0_ |= 0x00000004;
+ uint32_ = input.readUInt32();
+ break;
+ }
+ case 32: {
+ bitField0_ |= 0x00000008;
+ uint64_ = input.readUInt64();
+ break;
+ }
+ case 40: {
+ bitField0_ |= 0x00000010;
+ sint32_ = input.readSInt32();
+ break;
+ }
+ case 48: {
+ bitField0_ |= 0x00000020;
+ sint64_ = input.readSInt64();
+ break;
+ }
+ case 61: {
+ bitField0_ |= 0x00000040;
+ fixed32_ = input.readFixed32();
+ break;
+ }
+ case 65: {
+ bitField0_ |= 0x00000080;
+ fixed64_ = input.readFixed64();
+ break;
+ }
+ case 77: {
+ bitField0_ |= 0x00000100;
+ sfixed32_ = input.readSFixed32();
+ break;
+ }
+ case 81: {
+ bitField0_ |= 0x00000200;
+ sfixed64_ = input.readSFixed64();
+ break;
+ }
+ case 93: {
+ bitField0_ |= 0x00000400;
+ float_ = input.readFloat();
+ break;
+ }
+ case 97: {
+ bitField0_ |= 0x00000800;
+ double_ = input.readDouble();
+ break;
+ }
+ case 104: {
+ bitField0_ |= 0x00001000;
+ bool_ = input.readBool();
+ break;
+ }
+ case 114: {
+ bitField0_ |= 0x00002000;
+ string_ = input.readBytes();
+ break;
+ }
+ case 122: {
+ bitField0_ |= 0x00004000;
+ bytes_ = input.readBytes();
+ break;
+ }
+ case 128: {
+ int rawValue = input.readEnum();
+ org.apache.avro.protobuf.Test.A value = org.apache.avro.protobuf.Test.A.valueOf(rawValue);
+ if (value == null) {
+ unknownFields.mergeVarintField(16, rawValue);
+ } else {
+ bitField0_ |= 0x00008000;
+ enum_ = value;
+ }
+ break;
+ }
+ case 136: {
+ ensureIntArrayIsMutable();
+ intArray_.add(input.readInt32());
+ break;
+ }
+ case 138: {
+ int length = input.readRawVarint32();
+ int limit = input.pushLimit(length);
+ while (input.getBytesUntilLimit() > 0) {
+ addIntArray(input.readInt32());
+ }
+ input.popLimit(limit);
+ break;
+ }
+ case 146: {
+ org.apache.avro.protobuf.Test.Foo.Builder subBuilder = org.apache.avro.protobuf.Test.Foo.newBuilder();
+ if (hasFoo()) {
+ subBuilder.mergeFrom(getFoo());
+ }
+ input.readMessage(subBuilder, extensionRegistry);
+ setFoo(subBuilder.buildPartial());
+ break;
+ }
+ }
+ }
+ }
+
+ private int bitField0_;
+
+ // required int32 int32 = 1;
+ private int int32_ ;
+ public boolean hasInt32() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public int getInt32() {
+ return int32_;
+ }
+ public Builder setInt32(int value) {
+ bitField0_ |= 0x00000001;
+ int32_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearInt32() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ int32_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 int64 = 2;
+ private long int64_ ;
+ public boolean hasInt64() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public long getInt64() {
+ return int64_;
+ }
+ public Builder setInt64(long value) {
+ bitField0_ |= 0x00000002;
+ int64_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearInt64() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ int64_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional uint32 uint32 = 3;
+ private int uint32_ ;
+ public boolean hasUint32() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ public int getUint32() {
+ return uint32_;
+ }
+ public Builder setUint32(int value) {
+ bitField0_ |= 0x00000004;
+ uint32_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearUint32() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ uint32_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional uint64 uint64 = 4;
+ private long uint64_ ;
+ public boolean hasUint64() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ public long getUint64() {
+ return uint64_;
+ }
+ public Builder setUint64(long value) {
+ bitField0_ |= 0x00000008;
+ uint64_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearUint64() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ uint64_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional sint32 sint32 = 5;
+ private int sint32_ ;
+ public boolean hasSint32() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ public int getSint32() {
+ return sint32_;
+ }
+ public Builder setSint32(int value) {
+ bitField0_ |= 0x00000010;
+ sint32_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearSint32() {
+ bitField0_ = (bitField0_ & ~0x00000010);
+ sint32_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional sint64 sint64 = 6;
+ private long sint64_ ;
+ public boolean hasSint64() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ public long getSint64() {
+ return sint64_;
+ }
+ public Builder setSint64(long value) {
+ bitField0_ |= 0x00000020;
+ sint64_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearSint64() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ sint64_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional fixed32 fixed32 = 7;
+ private int fixed32_ ;
+ public boolean hasFixed32() {
+ return ((bitField0_ & 0x00000040) == 0x00000040);
+ }
+ public int getFixed32() {
+ return fixed32_;
+ }
+ public Builder setFixed32(int value) {
+ bitField0_ |= 0x00000040;
+ fixed32_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearFixed32() {
+ bitField0_ = (bitField0_ & ~0x00000040);
+ fixed32_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional fixed64 fixed64 = 8;
+ private long fixed64_ ;
+ public boolean hasFixed64() {
+ return ((bitField0_ & 0x00000080) == 0x00000080);
+ }
+ public long getFixed64() {
+ return fixed64_;
+ }
+ public Builder setFixed64(long value) {
+ bitField0_ |= 0x00000080;
+ fixed64_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearFixed64() {
+ bitField0_ = (bitField0_ & ~0x00000080);
+ fixed64_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional sfixed32 sfixed32 = 9;
+ private int sfixed32_ ;
+ public boolean hasSfixed32() {
+ return ((bitField0_ & 0x00000100) == 0x00000100);
+ }
+ public int getSfixed32() {
+ return sfixed32_;
+ }
+ public Builder setSfixed32(int value) {
+ bitField0_ |= 0x00000100;
+ sfixed32_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearSfixed32() {
+ bitField0_ = (bitField0_ & ~0x00000100);
+ sfixed32_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional sfixed64 sfixed64 = 10;
+ private long sfixed64_ ;
+ public boolean hasSfixed64() {
+ return ((bitField0_ & 0x00000200) == 0x00000200);
+ }
+ public long getSfixed64() {
+ return sfixed64_;
+ }
+ public Builder setSfixed64(long value) {
+ bitField0_ |= 0x00000200;
+ sfixed64_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearSfixed64() {
+ bitField0_ = (bitField0_ & ~0x00000200);
+ sfixed64_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional float float = 11;
+ private float float_ ;
+ public boolean hasFloat() {
+ return ((bitField0_ & 0x00000400) == 0x00000400);
+ }
+ public float getFloat() {
+ return float_;
+ }
+ public Builder setFloat(float value) {
+ bitField0_ |= 0x00000400;
+ float_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearFloat() {
+ bitField0_ = (bitField0_ & ~0x00000400);
+ float_ = 0F;
+ onChanged();
+ return this;
+ }
+
+ // optional double double = 12;
+ private double double_ ;
+ public boolean hasDouble() {
+ return ((bitField0_ & 0x00000800) == 0x00000800);
+ }
+ public double getDouble() {
+ return double_;
+ }
+ public Builder setDouble(double value) {
+ bitField0_ |= 0x00000800;
+ double_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearDouble() {
+ bitField0_ = (bitField0_ & ~0x00000800);
+ double_ = 0D;
+ onChanged();
+ return this;
+ }
+
+ // optional bool bool = 13;
+ private boolean bool_ ;
+ public boolean hasBool() {
+ return ((bitField0_ & 0x00001000) == 0x00001000);
+ }
+ public boolean getBool() {
+ return bool_;
+ }
+ public Builder setBool(boolean value) {
+ bitField0_ |= 0x00001000;
+ bool_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearBool() {
+ bitField0_ = (bitField0_ & ~0x00001000);
+ bool_ = false;
+ onChanged();
+ return this;
+ }
+
+ // optional string string = 14;
+ private java.lang.Object string_ = "";
+ public boolean hasString() {
+ return ((bitField0_ & 0x00002000) == 0x00002000);
+ }
+ public java.lang.String getString() {
+ java.lang.Object ref = string_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ string_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ public Builder setString(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00002000;
+ string_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearString() {
+ bitField0_ = (bitField0_ & ~0x00002000);
+ string_ = getDefaultInstance().getString();
+ onChanged();
+ return this;
+ }
+ void setString(com.google.protobuf.ByteString value) {
+ bitField0_ |= 0x00002000;
+ string_ = value;
+ onChanged();
+ }
+
+ // optional bytes bytes = 15;
+ private com.google.protobuf.ByteString bytes_ = com.google.protobuf.ByteString.EMPTY;
+ public boolean hasBytes() {
+ return ((bitField0_ & 0x00004000) == 0x00004000);
+ }
+ public com.google.protobuf.ByteString getBytes() {
+ return bytes_;
+ }
+ public Builder setBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00004000;
+ bytes_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearBytes() {
+ bitField0_ = (bitField0_ & ~0x00004000);
+ bytes_ = getDefaultInstance().getBytes();
+ onChanged();
+ return this;
+ }
+
+ // optional .org.apache.avro.protobuf.A enum = 16;
+ private org.apache.avro.protobuf.Test.A enum_ = org.apache.avro.protobuf.Test.A.X;
+ public boolean hasEnum() {
+ return ((bitField0_ & 0x00008000) == 0x00008000);
+ }
+ public org.apache.avro.protobuf.Test.A getEnum() {
+ return enum_;
+ }
+ public Builder setEnum(org.apache.avro.protobuf.Test.A value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00008000;
+ enum_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearEnum() {
+ bitField0_ = (bitField0_ & ~0x00008000);
+ enum_ = org.apache.avro.protobuf.Test.A.X;
+ onChanged();
+ return this;
+ }
+
+ // repeated int32 intArray = 17;
+ private java.util.List<java.lang.Integer> intArray_ = java.util.Collections.emptyList();
+ private void ensureIntArrayIsMutable() {
+ if (!((bitField0_ & 0x00010000) == 0x00010000)) {
+ intArray_ = new java.util.ArrayList<java.lang.Integer>(intArray_);
+ bitField0_ |= 0x00010000;
+ }
+ }
+ public java.util.List<java.lang.Integer>
+ getIntArrayList() {
+ return java.util.Collections.unmodifiableList(intArray_);
+ }
+ public int getIntArrayCount() {
+ return intArray_.size();
+ }
+ public int getIntArray(int index) {
+ return intArray_.get(index);
+ }
+ public Builder setIntArray(
+ int index, int value) {
+ ensureIntArrayIsMutable();
+ intArray_.set(index, value);
+ onChanged();
+ return this;
+ }
+ public Builder addIntArray(int value) {
+ ensureIntArrayIsMutable();
+ intArray_.add(value);
+ onChanged();
+ return this;
+ }
+ public Builder addAllIntArray(
+ java.lang.Iterable<? extends java.lang.Integer> values) {
+ ensureIntArrayIsMutable();
+ super.addAll(values, intArray_);
+ onChanged();
+ return this;
+ }
+ public Builder clearIntArray() {
+ intArray_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00010000);
+ onChanged();
+ return this;
+ }
+
+ // optional .org.apache.avro.protobuf.Foo foo = 18;
+ private org.apache.avro.protobuf.Test.Foo foo_ = org.apache.avro.protobuf.Test.Foo.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.avro.protobuf.Test.Foo, org.apache.avro.protobuf.Test.Foo.Builder, org.apache.avro.protobuf.Test.FooOrBuilder> fooBuilder_;
+ public boolean hasFoo() {
+ return ((bitField0_ & 0x00020000) == 0x00020000);
+ }
+ public org.apache.avro.protobuf.Test.Foo getFoo() {
+ if (fooBuilder_ == null) {
+ return foo_;
+ } else {
+ return fooBuilder_.getMessage();
+ }
+ }
+ public Builder setFoo(org.apache.avro.protobuf.Test.Foo value) {
+ if (fooBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ foo_ = value;
+ onChanged();
+ } else {
+ fooBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00020000;
+ return this;
+ }
+ public Builder setFoo(
+ org.apache.avro.protobuf.Test.Foo.Builder builderForValue) {
+ if (fooBuilder_ == null) {
+ foo_ = builderForValue.build();
+ onChanged();
+ } else {
+ fooBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00020000;
+ return this;
+ }
+ public Builder mergeFoo(org.apache.avro.protobuf.Test.Foo value) {
+ if (fooBuilder_ == null) {
+ if (((bitField0_ & 0x00020000) == 0x00020000) &&
+ foo_ != org.apache.avro.protobuf.Test.Foo.getDefaultInstance()) {
+ foo_ =
+ org.apache.avro.protobuf.Test.Foo.newBuilder(foo_).mergeFrom(value).buildPartial();
+ } else {
+ foo_ = value;
+ }
+ onChanged();
+ } else {
+ fooBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00020000;
+ return this;
+ }
+ public Builder clearFoo() {
+ if (fooBuilder_ == null) {
+ foo_ = org.apache.avro.protobuf.Test.Foo.getDefaultInstance();
+ onChanged();
+ } else {
+ fooBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00020000);
+ return this;
+ }
+ public org.apache.avro.protobuf.Test.Foo.Builder getFooBuilder() {
+ bitField0_ |= 0x00020000;
+ onChanged();
+ return getFooFieldBuilder().getBuilder();
+ }
+ public org.apache.avro.protobuf.Test.FooOrBuilder getFooOrBuilder() {
+ if (fooBuilder_ != null) {
+ return fooBuilder_.getMessageOrBuilder();
+ } else {
+ return foo_;
+ }
+ }
+ private com.google.protobuf.SingleFieldBuilder<
+ org.apache.avro.protobuf.Test.Foo, org.apache.avro.protobuf.Test.Foo.Builder, org.apache.avro.protobuf.Test.FooOrBuilder>
+ getFooFieldBuilder() {
+ if (fooBuilder_ == null) {
+ fooBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.apache.avro.protobuf.Test.Foo, org.apache.avro.protobuf.Test.Foo.Builder, org.apache.avro.protobuf.Test.FooOrBuilder>(
+ foo_,
+ getParentForChildren(),
+ isClean());
+ foo_ = null;
+ }
+ return fooBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.apache.avro.protobuf.Foo)
+ }
+
+ static {
+ defaultInstance = new Foo(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.apache.avro.protobuf.Foo)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_apache_avro_protobuf_Foo_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_apache_avro_protobuf_Foo_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\034src/test/protobuf/test.proto\022\030org.apac" +
+ "he.avro.protobuf\"\336\002\n\003Foo\022\r\n\005int32\030\001 \002(\005\022" +
+ "\r\n\005int64\030\002 \001(\003\022\016\n\006uint32\030\003 \001(\r\022\016\n\006uint64" +
+ "\030\004 \001(\004\022\016\n\006sint32\030\005 \001(\021\022\016\n\006sint64\030\006 \001(\022\022\017" +
+ "\n\007fixed32\030\007 \001(\007\022\017\n\007fixed64\030\010 \001(\006\022\020\n\010sfix" +
+ "ed32\030\t \001(\017\022\020\n\010sfixed64\030\n \001(\020\022\r\n\005float\030\013 " +
+ "\001(\002\022\016\n\006double\030\014 \001(\001\022\014\n\004bool\030\r \001(\010\022\016\n\006str" +
+ "ing\030\016 \001(\t\022\r\n\005bytes\030\017 \001(\014\022)\n\004enum\030\020 \001(\0162\033" +
+ ".org.apache.avro.protobuf.A\022\020\n\010intArray\030" +
+ "\021 \003(\005\022*\n\003foo\030\022 \001(\0132\035.org.apache.avro.pro",
+ "tobuf.Foo*\030\n\001A\022\005\n\001X\020\001\022\005\n\001Y\020\002\022\005\n\001Z\020\003"
+ };
+ 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;
+ internal_static_org_apache_avro_protobuf_Foo_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_apache_avro_protobuf_Foo_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_apache_avro_protobuf_Foo_descriptor,
+ new java.lang.String[] { "Int32", "Int64", "Uint32", "Uint64", "Sint32", "Sint64", "Fixed32", "Fixed64", "Sfixed32", "Sfixed64", "Float", "Double", "Bool", "String", "Bytes", "Enum", "IntArray", "Foo", },
+ org.apache.avro.protobuf.Test.Foo.class,
+ org.apache.avro.protobuf.Test.Foo.Builder.class);
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
Modified: avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java (original)
+++ avro/trunk/lang/java/protobuf/src/test/java/org/apache/avro/protobuf/TestProtobuf.java Wed Oct 5 21:17:31 2011
@@ -29,8 +29,8 @@ import static org.junit.Assert.assertEqu
import com.google.protobuf.ByteString;
-import pb.Test.Foo;
-import pb.Test.A;
+import org.apache.avro.protobuf.Test.Foo;
+import org.apache.avro.protobuf.Test.A;
public class TestProtobuf {
@Test public void testMessage() throws Exception {
Modified: avro/trunk/lang/java/protobuf/src/test/protobuf/test.proto
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/src/test/protobuf/test.proto?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/src/test/protobuf/test.proto (original)
+++ avro/trunk/lang/java/protobuf/src/test/protobuf/test.proto Wed Oct 5 21:17:31 2011
@@ -1,4 +1,22 @@
-package pb;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.avro.protobuf;
message Foo {
// all the primitive types
Modified: avro/trunk/lang/java/thrift/src/test/thrift/test.thrift
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/thrift/src/test/thrift/test.thrift?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/lang/java/thrift/src/test/thrift/test.thrift (original)
+++ avro/trunk/lang/java/thrift/src/test/thrift/test.thrift Wed Oct 5 21:17:31 2011
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
namespace java org.apache.avro.thrift.test
enum E {
Modified: avro/trunk/share/rat-excludes.txt
URL: http://svn.apache.org/viewvc/avro/trunk/share/rat-excludes.txt?rev=1179443&r1=1179442&r2=1179443&view=diff
==============================================================================
--- avro/trunk/share/rat-excludes.txt (original)
+++ avro/trunk/share/rat-excludes.txt Wed Oct 5 21:17:31 2011
@@ -36,5 +36,7 @@ lang/csharp/Avro.sln
lang/csharp/Avro.nunit
lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/static/*.js
lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/static/*.css
+lang/java/protobuf/src/test/java/org/apache/avro/protobuf/Test.java
+lang/java/thrift/src/test/java/org/apache/avro/thrift/test/*.java
lang/java/tools/src/test/compiler/output/*.java
share/test/data/test.avro12