diff options
Diffstat (limited to 'src/main/java/com/orbekk/example/Example.java')
-rw-r--r-- | src/main/java/com/orbekk/example/Example.java | 302 |
1 files changed, 213 insertions, 89 deletions
diff --git a/src/main/java/com/orbekk/example/Example.java b/src/main/java/com/orbekk/example/Example.java index 511cf35..9aa5f2b 100644 --- a/src/main/java/com/orbekk/example/Example.java +++ b/src/main/java/com/orbekk/example/Example.java @@ -8,11 +8,15 @@ public final class Example { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } + public interface EmptyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } public static final class Empty extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements EmptyOrBuilder { // Use Empty.newBuilder() to construct. - private Empty() { - initFields(); + private Empty(Builder builder) { + super(builder); } private Empty(boolean noInit) {} @@ -37,7 +41,12 @@ public final class Example { private void initFields() { } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; return true; } @@ -58,6 +67,13 @@ public final class Example { 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 com.orbekk.example.Example.Empty parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -132,34 +148,49 @@ public final class Example { } 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> { - private com.orbekk.example.Example.Empty result; + com.google.protobuf.GeneratedMessage.Builder<Builder> + implements com.orbekk.example.Example.EmptyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.orbekk.example.Example.internal_static_com_orbekk_example_Empty_descriptor; + } - // Construct using com.orbekk.example.Example.Empty.newBuilder() - private Builder() {} + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.orbekk.example.Example.internal_static_com_orbekk_example_Empty_fieldAccessorTable; + } - private static Builder create() { - Builder builder = new Builder(); - builder.result = new com.orbekk.example.Example.Empty(); - return builder; + // Construct using com.orbekk.example.Example.Empty.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); } - protected com.orbekk.example.Example.Empty internalGetResult() { - return result; + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); } public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new com.orbekk.example.Example.Empty(); + super.clear(); return this; } public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor @@ -171,33 +202,28 @@ public final class Example { return com.orbekk.example.Example.Empty.getDefaultInstance(); } - public boolean isInitialized() { - return result.isInitialized(); - } public com.orbekk.example.Example.Empty build() { - if (result != null && !isInitialized()) { + com.orbekk.example.Example.Empty result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } private com.orbekk.example.Example.Empty buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + com.orbekk.example.Example.Empty result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } public com.orbekk.example.Example.Empty buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - com.orbekk.example.Example.Empty returnMe = result; - result = null; - return returnMe; + com.orbekk.example.Example.Empty result = new com.orbekk.example.Example.Empty(this); + onBuilt(); + return result; } public Builder mergeFrom(com.google.protobuf.Message other) { @@ -215,6 +241,10 @@ public final class Example { return this; } + public final boolean isInitialized() { + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -227,11 +257,13 @@ public final class Example { 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; @@ -246,18 +278,25 @@ public final class Example { static { defaultInstance = new Empty(true); - com.orbekk.example.Example.internalForceInit(); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.orbekk.example.Empty) } + public interface FortuneReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string fortune = 1; + boolean hasFortune(); + String getFortune(); + } public static final class FortuneReply extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements FortuneReplyOrBuilder { // Use FortuneReply.newBuilder() to construct. - private FortuneReply() { - initFields(); + private FortuneReply(Builder builder) { + super(builder); } private FortuneReply(boolean noInit) {} @@ -280,25 +319,60 @@ public final class Example { return com.orbekk.example.Example.internal_static_com_orbekk_example_FortuneReply_fieldAccessorTable; } + private int bitField0_; // required string fortune = 1; public static final int FORTUNE_FIELD_NUMBER = 1; - private boolean hasFortune; - private java.lang.String fortune_ = ""; - public boolean hasFortune() { return hasFortune; } - public java.lang.String getFortune() { return fortune_; } + private java.lang.Object fortune_; + public boolean hasFortune() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFortune() { + java.lang.Object ref = fortune_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fortune_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFortuneBytes() { + java.lang.Object ref = fortune_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fortune_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } private void initFields() { + fortune_ = ""; } + private byte memoizedIsInitialized = -1; public final boolean isInitialized() { - if (!hasFortune) return false; + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasFortune()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasFortune()) { - output.writeString(1, getFortune()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFortuneBytes()); } getUnknownFields().writeTo(output); } @@ -309,15 +383,22 @@ public final class Example { if (size != -1) return size; size = 0; - if (hasFortune()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getFortune()); + .computeBytesSize(1, getFortuneBytes()); } 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 com.orbekk.example.Example.FortuneReply parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -392,34 +473,51 @@ public final class Example { } 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> { - private com.orbekk.example.Example.FortuneReply result; + com.google.protobuf.GeneratedMessage.Builder<Builder> + implements com.orbekk.example.Example.FortuneReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.orbekk.example.Example.internal_static_com_orbekk_example_FortuneReply_descriptor; + } - // Construct using com.orbekk.example.Example.FortuneReply.newBuilder() - private Builder() {} + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.orbekk.example.Example.internal_static_com_orbekk_example_FortuneReply_fieldAccessorTable; + } - private static Builder create() { - Builder builder = new Builder(); - builder.result = new com.orbekk.example.Example.FortuneReply(); - return builder; + // Construct using com.orbekk.example.Example.FortuneReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); } - protected com.orbekk.example.Example.FortuneReply internalGetResult() { - return result; + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); } public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new com.orbekk.example.Example.FortuneReply(); + super.clear(); + fortune_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor @@ -431,33 +529,35 @@ public final class Example { return com.orbekk.example.Example.FortuneReply.getDefaultInstance(); } - public boolean isInitialized() { - return result.isInitialized(); - } public com.orbekk.example.Example.FortuneReply build() { - if (result != null && !isInitialized()) { + com.orbekk.example.Example.FortuneReply result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } private com.orbekk.example.Example.FortuneReply buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + com.orbekk.example.Example.FortuneReply result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } public com.orbekk.example.Example.FortuneReply buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + com.orbekk.example.Example.FortuneReply result = new com.orbekk.example.Example.FortuneReply(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - com.orbekk.example.Example.FortuneReply returnMe = result; - result = null; - return returnMe; + result.fortune_ = fortune_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; } public Builder mergeFrom(com.google.protobuf.Message other) { @@ -478,6 +578,14 @@ public final class Example { return this; } + public final boolean isInitialized() { + if (!hasFortune()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -490,51 +598,69 @@ public final class Example { 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 10: { - setFortune(input.readString()); + bitField0_ |= 0x00000001; + fortune_ = input.readBytes(); break; } } } } + private int bitField0_; // required string fortune = 1; + private java.lang.Object fortune_ = ""; public boolean hasFortune() { - return result.hasFortune(); - } - public java.lang.String getFortune() { - return result.getFortune(); + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFortune() { + java.lang.Object ref = fortune_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fortune_ = s; + return s; + } else { + return (String) ref; + } } - public Builder setFortune(java.lang.String value) { + public Builder setFortune(String value) { if (value == null) { throw new NullPointerException(); } - result.hasFortune = true; - result.fortune_ = value; + bitField0_ |= 0x00000001; + fortune_ = value; + onChanged(); return this; } public Builder clearFortune() { - result.hasFortune = false; - result.fortune_ = getDefaultInstance().getFortune(); + bitField0_ = (bitField0_ & ~0x00000001); + fortune_ = getDefaultInstance().getFortune(); + onChanged(); return this; } + void setFortune(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fortune_ = value; + onChanged(); + } // @@protoc_insertion_point(builder_scope:com.orbekk.example.FortuneReply) } static { defaultInstance = new FortuneReply(true); - com.orbekk.example.Example.internalForceInit(); defaultInstance.initFields(); } @@ -556,7 +682,7 @@ public final class Example { public static com.google.protobuf.Service newReflectiveService( final Interface impl) { return new FortuneService() { - @Override + @java.lang.Override public void getFortune( com.google.protobuf.RpcController controller, com.orbekk.example.Example.Empty request, @@ -818,7 +944,5 @@ public final class Example { }, assigner); } - public static void internalForceInit() {} - // @@protoc_insertion_point(outer_class_scope) } |