com.google.protobuf.Value Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protobuf-javalite Show documentation
Show all versions of protobuf-javalite Show documentation
Lite version of Protocol Buffers library. This version is optimized for code size, but does
not guarantee API/ABI stability.
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
package com.google.protobuf;
/**
*
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of that
* variants, absence of any variant indicates an error.
* The JSON representation for `Value` is JSON value.
*
*
* Protobuf type {@code google.protobuf.Value}
*/
public final class Value extends
com.google.protobuf.GeneratedMessageLite<
Value, Value.Builder> implements
// @@protoc_insertion_point(message_implements:google.protobuf.Value)
ValueOrBuilder {
private Value() {
}
private int kindCase_ = 0;
private java.lang.Object kind_;
public enum KindCase
implements com.google.protobuf.Internal.EnumLite {
NULL_VALUE(1),
NUMBER_VALUE(2),
STRING_VALUE(3),
BOOL_VALUE(4),
STRUCT_VALUE(5),
LIST_VALUE(6),
KIND_NOT_SET(0);
private final int value;
private KindCase(int value) {
this.value = value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static KindCase valueOf(int value) {
return forNumber(value);
}
public static KindCase forNumber(int value) {
switch (value) {
case 1: return NULL_VALUE;
case 2: return NUMBER_VALUE;
case 3: return STRING_VALUE;
case 4: return BOOL_VALUE;
case 5: return STRUCT_VALUE;
case 6: return LIST_VALUE;
case 0: return KIND_NOT_SET;
default: return null;
}
}
@java.lang.Override
public int getNumber() {
return this.value;
}
};
@java.lang.Override
public KindCase
getKindCase() {
return KindCase.forNumber(
kindCase_);
}
private void clearKind() {
kindCase_ = 0;
kind_ = null;
}
public static final int NULL_VALUE_FIELD_NUMBER = 1;
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
@java.lang.Override
public int getNullValueValue() {
if (kindCase_ == 1) {
return (java.lang.Integer) kind_;
}
return 0;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
@java.lang.Override
public com.google.protobuf.NullValue getNullValue() {
if (kindCase_ == 1) {
com.google.protobuf.NullValue result = com.google.protobuf.NullValue.forNumber((java.lang.Integer) kind_);
return result == null ? com.google.protobuf.NullValue.UNRECOGNIZED : result;
}
return com.google.protobuf.NullValue.NULL_VALUE;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
private void setNullValueValue(int value) {
kindCase_ = 1;
kind_ = value;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
private void setNullValue(com.google.protobuf.NullValue value) {
if (value == null) {
throw new NullPointerException();
}
kindCase_ = 1;
kind_ = value.getNumber();
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
private void clearNullValue() {
if (kindCase_ == 1) {
kindCase_ = 0;
kind_ = null;
}
}
public static final int NUMBER_VALUE_FIELD_NUMBER = 2;
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
@java.lang.Override
public double getNumberValue() {
if (kindCase_ == 2) {
return (java.lang.Double) kind_;
}
return 0D;
}
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
private void setNumberValue(double value) {
kindCase_ = 2;
kind_ = value;
}
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
private void clearNumberValue() {
if (kindCase_ == 2) {
kindCase_ = 0;
kind_ = null;
}
}
public static final int STRING_VALUE_FIELD_NUMBER = 3;
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
@java.lang.Override
public java.lang.String getStringValue() {
java.lang.String ref = "";
if (kindCase_ == 3) {
ref = (java.lang.String) kind_;
}
return ref;
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
@java.lang.Override
public com.google.protobuf.ByteString
getStringValueBytes() {
java.lang.String ref = "";
if (kindCase_ == 3) {
ref = (java.lang.String) kind_;
}
return com.google.protobuf.ByteString.copyFromUtf8(ref);
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
private void setStringValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
kindCase_ = 3;
kind_ = value;
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
private void clearStringValue() {
if (kindCase_ == 3) {
kindCase_ = 0;
kind_ = null;
}
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
private void setStringValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
kindCase_ = 3;
kind_ = value.toStringUtf8();
}
public static final int BOOL_VALUE_FIELD_NUMBER = 4;
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
@java.lang.Override
public boolean getBoolValue() {
if (kindCase_ == 4) {
return (java.lang.Boolean) kind_;
}
return false;
}
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
private void setBoolValue(boolean value) {
kindCase_ = 4;
kind_ = value;
}
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
private void clearBoolValue() {
if (kindCase_ == 4) {
kindCase_ = 0;
kind_ = null;
}
}
public static final int STRUCT_VALUE_FIELD_NUMBER = 5;
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
@java.lang.Override
public boolean hasStructValue() {
return kindCase_ == 5;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
@java.lang.Override
public com.google.protobuf.Struct getStructValue() {
if (kindCase_ == 5) {
return (com.google.protobuf.Struct) kind_;
}
return com.google.protobuf.Struct.getDefaultInstance();
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
private void setStructValue(com.google.protobuf.Struct value) {
if (value == null) {
throw new NullPointerException();
}
kind_ = value;
kindCase_ = 5;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
private void setStructValue(
com.google.protobuf.Struct.Builder builderForValue) {
kind_ = builderForValue.build();
kindCase_ = 5;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
private void mergeStructValue(com.google.protobuf.Struct value) {
if (value == null) {
throw new NullPointerException();
}
if (kindCase_ == 5 &&
kind_ != com.google.protobuf.Struct.getDefaultInstance()) {
kind_ = com.google.protobuf.Struct.newBuilder((com.google.protobuf.Struct) kind_)
.mergeFrom(value).buildPartial();
} else {
kind_ = value;
}
kindCase_ = 5;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
private void clearStructValue() {
if (kindCase_ == 5) {
kindCase_ = 0;
kind_ = null;
}
}
public static final int LIST_VALUE_FIELD_NUMBER = 6;
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
@java.lang.Override
public boolean hasListValue() {
return kindCase_ == 6;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
@java.lang.Override
public com.google.protobuf.ListValue getListValue() {
if (kindCase_ == 6) {
return (com.google.protobuf.ListValue) kind_;
}
return com.google.protobuf.ListValue.getDefaultInstance();
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
private void setListValue(com.google.protobuf.ListValue value) {
if (value == null) {
throw new NullPointerException();
}
kind_ = value;
kindCase_ = 6;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
private void setListValue(
com.google.protobuf.ListValue.Builder builderForValue) {
kind_ = builderForValue.build();
kindCase_ = 6;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
private void mergeListValue(com.google.protobuf.ListValue value) {
if (value == null) {
throw new NullPointerException();
}
if (kindCase_ == 6 &&
kind_ != com.google.protobuf.ListValue.getDefaultInstance()) {
kind_ = com.google.protobuf.ListValue.newBuilder((com.google.protobuf.ListValue) kind_)
.mergeFrom(value).buildPartial();
} else {
kind_ = value;
}
kindCase_ = 6;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
private void clearListValue() {
if (kindCase_ == 6) {
kindCase_ = 0;
kind_ = null;
}
}
public static com.google.protobuf.Value parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data);
}
public static com.google.protobuf.Value parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data, extensionRegistry);
}
public static com.google.protobuf.Value parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data);
}
public static com.google.protobuf.Value parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data, extensionRegistry);
}
public static com.google.protobuf.Value parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data);
}
public static com.google.protobuf.Value parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, data, extensionRegistry);
}
public static com.google.protobuf.Value parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, input);
}
public static com.google.protobuf.Value parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, input, extensionRegistry);
}
public static com.google.protobuf.Value parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return parseDelimitedFrom(DEFAULT_INSTANCE, input);
}
public static com.google.protobuf.Value parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry);
}
public static com.google.protobuf.Value parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, input);
}
public static com.google.protobuf.Value parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageLite.parseFrom(
DEFAULT_INSTANCE, input, extensionRegistry);
}
public static Builder newBuilder() {
return (Builder) DEFAULT_INSTANCE.createBuilder();
}
public static Builder newBuilder(com.google.protobuf.Value prototype) {
return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
}
/**
*
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of that
* variants, absence of any variant indicates an error.
* The JSON representation for `Value` is JSON value.
*
*
* Protobuf type {@code google.protobuf.Value}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageLite.Builder<
com.google.protobuf.Value, Builder> implements
// @@protoc_insertion_point(builder_implements:google.protobuf.Value)
com.google.protobuf.ValueOrBuilder {
// Construct using com.google.protobuf.Value.newBuilder()
private Builder() {
super(DEFAULT_INSTANCE);
}
@java.lang.Override
public KindCase
getKindCase() {
return instance.getKindCase();
}
public Builder clearKind() {
copyOnWrite();
instance.clearKind();
return this;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
@java.lang.Override
public int getNullValueValue() {
return instance.getNullValueValue();
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
public Builder setNullValueValue(int value) {
copyOnWrite();
instance.setNullValueValue(value);
return this;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
@java.lang.Override
public com.google.protobuf.NullValue getNullValue() {
return instance.getNullValue();
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
public Builder setNullValue(com.google.protobuf.NullValue value) {
copyOnWrite();
instance.setNullValue(value);
return this;
}
/**
*
* Represents a null value.
*
*
* .google.protobuf.NullValue null_value = 1;
*/
public Builder clearNullValue() {
copyOnWrite();
instance.clearNullValue();
return this;
}
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
@java.lang.Override
public double getNumberValue() {
return instance.getNumberValue();
}
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
public Builder setNumberValue(double value) {
copyOnWrite();
instance.setNumberValue(value);
return this;
}
/**
*
* Represents a double value.
*
*
* double number_value = 2;
*/
public Builder clearNumberValue() {
copyOnWrite();
instance.clearNumberValue();
return this;
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
@java.lang.Override
public java.lang.String getStringValue() {
return instance.getStringValue();
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
@java.lang.Override
public com.google.protobuf.ByteString
getStringValueBytes() {
return instance.getStringValueBytes();
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
public Builder setStringValue(
java.lang.String value) {
copyOnWrite();
instance.setStringValue(value);
return this;
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
public Builder clearStringValue() {
copyOnWrite();
instance.clearStringValue();
return this;
}
/**
*
* Represents a string value.
*
*
* string string_value = 3;
*/
public Builder setStringValueBytes(
com.google.protobuf.ByteString value) {
copyOnWrite();
instance.setStringValueBytes(value);
return this;
}
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
@java.lang.Override
public boolean getBoolValue() {
return instance.getBoolValue();
}
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
public Builder setBoolValue(boolean value) {
copyOnWrite();
instance.setBoolValue(value);
return this;
}
/**
*
* Represents a boolean value.
*
*
* bool bool_value = 4;
*/
public Builder clearBoolValue() {
copyOnWrite();
instance.clearBoolValue();
return this;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
@java.lang.Override
public boolean hasStructValue() {
return instance.hasStructValue();
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
@java.lang.Override
public com.google.protobuf.Struct getStructValue() {
return instance.getStructValue();
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
public Builder setStructValue(com.google.protobuf.Struct value) {
copyOnWrite();
instance.setStructValue(value);
return this;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
public Builder setStructValue(
com.google.protobuf.Struct.Builder builderForValue) {
copyOnWrite();
instance.setStructValue(builderForValue);
return this;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
public Builder mergeStructValue(com.google.protobuf.Struct value) {
copyOnWrite();
instance.mergeStructValue(value);
return this;
}
/**
*
* Represents a structured value.
*
*
* .google.protobuf.Struct struct_value = 5;
*/
public Builder clearStructValue() {
copyOnWrite();
instance.clearStructValue();
return this;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
@java.lang.Override
public boolean hasListValue() {
return instance.hasListValue();
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
@java.lang.Override
public com.google.protobuf.ListValue getListValue() {
return instance.getListValue();
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
public Builder setListValue(com.google.protobuf.ListValue value) {
copyOnWrite();
instance.setListValue(value);
return this;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
public Builder setListValue(
com.google.protobuf.ListValue.Builder builderForValue) {
copyOnWrite();
instance.setListValue(builderForValue);
return this;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
public Builder mergeListValue(com.google.protobuf.ListValue value) {
copyOnWrite();
instance.mergeListValue(value);
return this;
}
/**
*
* Represents a repeated `Value`.
*
*
* .google.protobuf.ListValue list_value = 6;
*/
public Builder clearListValue() {
copyOnWrite();
instance.clearListValue();
return this;
}
// @@protoc_insertion_point(builder_scope:google.protobuf.Value)
}
@java.lang.Override
@java.lang.SuppressWarnings({"unchecked", "fallthrough"})
protected final java.lang.Object dynamicMethod(
com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,
java.lang.Object arg0, java.lang.Object arg1) {
switch (method) {
case NEW_MUTABLE_INSTANCE: {
return new com.google.protobuf.Value();
}
case NEW_BUILDER: {
return new Builder();
}
case BUILD_MESSAGE_INFO: {
java.lang.Object[] objects = new java.lang.Object[] {
"kind_",
"kindCase_",
com.google.protobuf.Struct.class,
com.google.protobuf.ListValue.class,
};
java.lang.String info =
"\u0000\u0006\u0001\u0000\u0001\u0006\u0006\u0000\u0000\u0000\u0001?\u0000\u00023" +
"\u0000\u0003\u023b\u0000\u0004:\u0000\u0005<\u0000\u0006<\u0000";
return newMessageInfo(DEFAULT_INSTANCE, info, objects);
}
// fall through
case GET_DEFAULT_INSTANCE: {
return DEFAULT_INSTANCE;
}
case GET_PARSER: {
com.google.protobuf.Parser parser = PARSER;
if (parser == null) {
synchronized (com.google.protobuf.Value.class) {
parser = PARSER;
if (parser == null) {
parser =
new DefaultInstanceBasedParser(
DEFAULT_INSTANCE);
PARSER = parser;
}
}
}
return parser;
}
case GET_MEMOIZED_IS_INITIALIZED: {
return (byte) 1;
}
case SET_MEMOIZED_IS_INITIALIZED: {
return null;
}
}
throw new UnsupportedOperationException();
}
// @@protoc_insertion_point(class_scope:google.protobuf.Value)
private static final com.google.protobuf.Value DEFAULT_INSTANCE;
static {
Value defaultInstance = new Value();
// New instances are implicitly immutable so no need to make
// immutable.
DEFAULT_INSTANCE = defaultInstance;
com.google.protobuf.GeneratedMessageLite.registerDefaultInstance(
Value.class, defaultInstance);
}
public static com.google.protobuf.Value getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static volatile com.google.protobuf.Parser PARSER;
public static com.google.protobuf.Parser parser() {
return DEFAULT_INSTANCE.getParserForType();
}
}