Package com.github.xds.type.v3
Class TypedStruct.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderT>
-
- com.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
- com.github.xds.type.v3.TypedStruct.Builder
-
- All Implemented Interfaces:
TypedStructOrBuilder
,com.google.protobuf.Message.Builder
,com.google.protobuf.MessageLite.Builder
,com.google.protobuf.MessageLiteOrBuilder
,com.google.protobuf.MessageOrBuilder
,java.lang.Cloneable
- Enclosing class:
- TypedStruct
public static final class TypedStruct.Builder extends com.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder> implements TypedStructOrBuilder
A TypedStruct contains an arbitrary JSON serialized protocol buffer message with a URL that describes the type of the serialized message. This is very similar to google.protobuf.Any, instead of having protocol buffer binary, this employs google.protobuf.Struct as value. This message is intended to be embedded inside Any, so it shouldn't be directly referred from other UDPA messages. When packing an opaque extension config, packing the expected type into Any is preferred wherever possible for its efficiency. TypedStruct should be used only if a proto descriptor is not available, for example if: - A control plane sends opaque message that is originally from external source in human readable format such as JSON or YAML. - The control plane doesn't have the knowledge of the protocol buffer schema hence it cannot serialize the message in protocol buffer binary format. - The DPLB doesn't have have the knowledge of the protocol buffer schema its plugin or extension uses. This has to be indicated in the DPLB capability negotiation. When a DPLB receives a TypedStruct in Any, it should: - Check if the type_url of the TypedStruct matches the type the extension expects. - Convert value to the type described in type_url and perform validation. TODO(lizan): Figure out how TypeStruct should be used with DPLB extensions that doesn't link protobuf descriptor with DPLB itself, (e.g. gRPC LB Plugin, Envoy WASM extensions).
Protobuf typexds.type.v3.TypedStruct
-
-
Field Summary
Fields Modifier and Type Field Description private int
bitField0_
private java.lang.Object
typeUrl_
private com.google.protobuf.Struct
value_
private com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct,com.google.protobuf.Struct.Builder,com.google.protobuf.StructOrBuilder>
valueBuilder_
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypedStruct
build()
TypedStruct
buildPartial()
private void
buildPartial0(TypedStruct result)
TypedStruct.Builder
clear()
TypedStruct.Builder
clearTypeUrl()
A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.Builder
clearValue()
A JSON representation of the above specified type.TypedStruct
getDefaultInstanceForType()
static com.google.protobuf.Descriptors.Descriptor
getDescriptor()
com.google.protobuf.Descriptors.Descriptor
getDescriptorForType()
java.lang.String
getTypeUrl()
A URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.ByteString
getTypeUrlBytes()
A URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.Struct
getValue()
A JSON representation of the above specified type.com.google.protobuf.Struct.Builder
getValueBuilder()
A JSON representation of the above specified type.private com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct,com.google.protobuf.Struct.Builder,com.google.protobuf.StructOrBuilder>
getValueFieldBuilder()
A JSON representation of the above specified type.com.google.protobuf.StructOrBuilder
getValueOrBuilder()
A JSON representation of the above specified type.boolean
hasValue()
A JSON representation of the above specified type.protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable()
boolean
isInitialized()
private void
maybeForceBuilderInitialization()
TypedStruct.Builder
mergeFrom(TypedStruct other)
TypedStruct.Builder
mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
TypedStruct.Builder
mergeFrom(com.google.protobuf.Message other)
TypedStruct.Builder
mergeValue(com.google.protobuf.Struct value)
A JSON representation of the above specified type.TypedStruct.Builder
setTypeUrl(java.lang.String value)
A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.Builder
setTypeUrlBytes(com.google.protobuf.ByteString value)
A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.Builder
setValue(com.google.protobuf.Struct value)
A JSON representation of the above specified type.TypedStruct.Builder
setValue(com.google.protobuf.Struct.Builder builderForValue)
A JSON representation of the above specified type.-
Methods inherited from class com.google.protobuf.GeneratedMessage.Builder
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
bitField0_
private int bitField0_
-
typeUrl_
private java.lang.Object typeUrl_
-
value_
private com.google.protobuf.Struct value_
-
valueBuilder_
private com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct,com.google.protobuf.Struct.Builder,com.google.protobuf.StructOrBuilder> valueBuilder_
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTable
in classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
maybeForceBuilderInitialization
private void maybeForceBuilderInitialization()
-
clear
public TypedStruct.Builder clear()
- Specified by:
clear
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clear
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clear
in classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.Message.Builder
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.MessageOrBuilder
- Overrides:
getDescriptorForType
in classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
getDefaultInstanceForType
public TypedStruct getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
build
public TypedStruct build()
- Specified by:
build
in interfacecom.google.protobuf.Message.Builder
- Specified by:
build
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public TypedStruct buildPartial()
- Specified by:
buildPartial
in interfacecom.google.protobuf.Message.Builder
- Specified by:
buildPartial
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial0
private void buildPartial0(TypedStruct result)
-
mergeFrom
public TypedStruct.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>
-
mergeFrom
public TypedStruct.Builder mergeFrom(TypedStruct other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
mergeFrom
public TypedStruct.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>
- Throws:
java.io.IOException
-
getTypeUrl
public java.lang.String getTypeUrl()
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;
- Specified by:
getTypeUrl
in interfaceTypedStructOrBuilder
- Returns:
- The typeUrl.
-
getTypeUrlBytes
public com.google.protobuf.ByteString getTypeUrlBytes()
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;
- Specified by:
getTypeUrlBytes
in interfaceTypedStructOrBuilder
- Returns:
- The bytes for typeUrl.
-
setTypeUrl
public TypedStruct.Builder setTypeUrl(java.lang.String value)
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;
- Parameters:
value
- The typeUrl to set.- Returns:
- This builder for chaining.
-
clearTypeUrl
public TypedStruct.Builder clearTypeUrl()
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;
- Returns:
- This builder for chaining.
-
setTypeUrlBytes
public TypedStruct.Builder setTypeUrlBytes(com.google.protobuf.ByteString value)
A URL that uniquely identifies the type of the serialize protocol buffer message. This has same semantics and format described in google.protobuf.Any: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto
string type_url = 1;
- Parameters:
value
- The bytes for typeUrl to set.- Returns:
- This builder for chaining.
-
hasValue
public boolean hasValue()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
- Specified by:
hasValue
in interfaceTypedStructOrBuilder
- Returns:
- Whether the value field is set.
-
getValue
public com.google.protobuf.Struct getValue()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
- Specified by:
getValue
in interfaceTypedStructOrBuilder
- Returns:
- The value.
-
setValue
public TypedStruct.Builder setValue(com.google.protobuf.Struct value)
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
setValue
public TypedStruct.Builder setValue(com.google.protobuf.Struct.Builder builderForValue)
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
mergeValue
public TypedStruct.Builder mergeValue(com.google.protobuf.Struct value)
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
clearValue
public TypedStruct.Builder clearValue()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
getValueBuilder
public com.google.protobuf.Struct.Builder getValueBuilder()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
getValueOrBuilder
public com.google.protobuf.StructOrBuilder getValueOrBuilder()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
- Specified by:
getValueOrBuilder
in interfaceTypedStructOrBuilder
-
getValueFieldBuilder
private com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct,com.google.protobuf.Struct.Builder,com.google.protobuf.StructOrBuilder> getValueFieldBuilder()
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-
-