Package com.github.udpa.udpa.type.v1
Class TypedStruct.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderType>
-
- com.google.protobuf.GeneratedMessageV3.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.GeneratedMessageV3.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 typeudpa.type.v1.TypedStruct
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypedStruct.BuilderaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)TypedStructbuild()TypedStructbuildPartial()TypedStruct.Builderclear()TypedStruct.BuilderclearField(com.google.protobuf.Descriptors.FieldDescriptor field)TypedStruct.BuilderclearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)TypedStruct.BuilderclearTypeUrl()A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.BuilderclearValue()A JSON representation of the above specified type.TypedStruct.Builderclone()TypedStructgetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()StringgetTypeUrl()A URL that uniquely identifies the type of the serialize protocol buffer message.com.google.protobuf.ByteStringgetTypeUrlBytes()A 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.BuildergetValueBuilder()A JSON representation of the above specified type.com.google.protobuf.StructOrBuildergetValueOrBuilder()A JSON representation of the above specified type.booleanhasValue()A JSON representation of the above specified type.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()TypedStruct.BuildermergeFrom(TypedStruct other)TypedStruct.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)TypedStruct.BuildermergeFrom(com.google.protobuf.Message other)TypedStruct.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)TypedStruct.BuildermergeValue(com.google.protobuf.Struct value)A JSON representation of the above specified type.TypedStruct.BuildersetField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)TypedStruct.BuildersetRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)TypedStruct.BuildersetTypeUrl(String value)A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.BuildersetTypeUrlBytes(com.google.protobuf.ByteString value)A URL that uniquely identifies the type of the serialize protocol buffer message.TypedStruct.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)TypedStruct.BuildersetValue(com.google.protobuf.Struct value)A JSON representation of the above specified type.TypedStruct.BuildersetValue(com.google.protobuf.Struct.Builder builderForValue)A JSON representation of the above specified type.-
Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, 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
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
clear
public TypedStruct.Builder clear()
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.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.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
getDefaultInstanceForType
public TypedStruct getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public TypedStruct build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public TypedStruct buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
public TypedStruct.Builder clone()
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
setField
public TypedStruct.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
clearField
public TypedStruct.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
clearOneof
public TypedStruct.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
setRepeatedField
public TypedStruct.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
- Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
addRepeatedField
public TypedStruct.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
mergeFrom
public TypedStruct.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<TypedStruct.Builder>
-
mergeFrom
public TypedStruct.Builder mergeFrom(TypedStruct other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.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
public 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:
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
public TypedStruct.Builder setTypeUrl(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:
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
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:
getValueOrBuilderin interfaceTypedStructOrBuilder
-
setUnknownFields
public final TypedStruct.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
mergeUnknownFields
public final TypedStruct.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<TypedStruct.Builder>
-
-