Class TypedStruct.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>
com.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
com.github.udpa.udpa.type.v1.TypedStruct.Builder
- All Implemented Interfaces:
TypedStructOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, 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 type
udpa.type.v1.TypedStruct-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate Objectprivate com.google.protobuf.Structprivate com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()private voidbuildPartial0(TypedStruct result) clear()A URL that uniquely identifies the type of the serialize protocol buffer message.A JSON representation of the above specified type.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorA URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.ByteStringA URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.StructgetValue()A JSON representation of the above specified type.com.google.protobuf.Struct.BuilderA JSON representation of the above specified type.com.google.protobuf.StructOrBuilderA JSON representation of the above specified type.booleanhasValue()A JSON representation of the above specified type.protected com.google.protobuf.GeneratedMessage.FieldAccessorTableprivate com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> A JSON representation of the above specified type.final booleanprivate voidmergeFrom(TypedStruct other) mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeValue(com.google.protobuf.Struct value) A JSON representation of the above specified type.setTypeUrl(String value) A URL that uniquely identifies the type of the serialize protocol buffer message.setTypeUrlBytes(com.google.protobuf.ByteString value) A URL that uniquely identifies the type of the serialize protocol buffer message.setValue(com.google.protobuf.Struct value) A JSON representation of the above specified type.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, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Field Details
-
bitField0_
private int bitField0_ -
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_
-
-
Constructor Details
-
Builder
private Builder() -
Builder
private Builder(com.google.protobuf.AbstractMessage.BuilderParent parent)
-
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
maybeForceBuilderInitialization
private void maybeForceBuilderInitialization() -
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial0
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<TypedStruct.Builder>
-
mergeFrom
public TypedStruct.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>- Throws:
IOException
-
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:
getTypeUrlin 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:
getTypeUrlBytesin interfaceTypedStructOrBuilder- Returns:
- The bytes for typeUrl.
-
setTypeUrl
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
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
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:
hasValuein 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:
getValuein interfaceTypedStructOrBuilder- Returns:
- The value.
-
setValue
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2; -
setValue
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2; -
mergeValue
A JSON representation of the above specified type.
.google.protobuf.Struct value = 2; -
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:
getValueOrBuilderin interfaceTypedStructOrBuilder
-
internalGetValueFieldBuilder
private com.google.protobuf.SingleFieldBuilder<com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> internalGetValueFieldBuilder()A JSON representation of the above specified type.
.google.protobuf.Struct value = 2;
-