Class StructMatcher.Builder

  • All Implemented Interfaces:
    com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, StructMatcherOrBuilder, java.lang.Cloneable
    Enclosing class:
    StructMatcher

    public static final class StructMatcher.Builder
    extends com.google.protobuf.GeneratedMessage.Builder<StructMatcher.Builder>
    implements StructMatcherOrBuilder
     StructMatcher provides a general interface to check if a given value is matched in
     google.protobuf.Struct. It uses ``path`` to retrieve the value
     from the struct and then check if it's matched to the specified value.
    
     For example, for the following Struct:
    
     .. code-block:: yaml
    
     fields:
     a:
     struct_value:
     fields:
     b:
     struct_value:
     fields:
     c:
     string_value: pro
     t:
     list_value:
     values:
     - string_value: m
     - string_value: n
    
     The following MetadataMatcher is matched as the path [a, b, c] will retrieve a string value "pro"
     from the Metadata which is matched to the specified prefix match.
    
     .. code-block:: yaml
    
     path:
     - key: a
     - key: b
     - key: c
     value:
     string_match:
     prefix: pr
    
     The following StructMatcher is matched as the code will match one of the string values in the
     list at the path [a, t].
    
     .. code-block:: yaml
    
     path:
     - key: a
     - key: t
     value:
     list_match:
     one_of:
     string_match:
     exact: m
    
     An example use of StructMatcher is to match metadata in envoy.v*.core.Node.
     
    Protobuf type envoy.type.matcher.v3.StructMatcher
    • Constructor Detail

      • Builder

        private Builder()
      • Builder

        private Builder​(com.google.protobuf.AbstractMessage.BuilderParent parent)
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<StructMatcher.Builder>
      • maybeForceBuilderInitialization

        private void maybeForceBuilderInitialization()
      • clear

        public StructMatcher.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessage.Builder<StructMatcher.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<StructMatcher.Builder>
      • getDefaultInstanceForType

        public StructMatcher getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public StructMatcher build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public StructMatcher buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • buildPartialRepeatedFields

        private void buildPartialRepeatedFields​(StructMatcher result)
      • buildPartial0

        private void buildPartial0​(StructMatcher result)
      • mergeFrom

        public StructMatcher.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<StructMatcher.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage.Builder<StructMatcher.Builder>
      • mergeFrom

        public StructMatcher.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<StructMatcher.Builder>
        Throws:
        java.io.IOException
      • ensurePathIsMutable

        private void ensurePathIsMutable()
      • getPathCount

        public int getPathCount()
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
        Specified by:
        getPathCount in interface StructMatcherOrBuilder
      • getPath

        public StructMatcher.PathSegment getPath​(int index)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
        Specified by:
        getPath in interface StructMatcherOrBuilder
      • setPath

        public StructMatcher.Builder setPath​(int index,
                                             StructMatcher.PathSegment value)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • addPath

        public StructMatcher.Builder addPath​(int index,
                                             StructMatcher.PathSegment value)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • addAllPath

        public StructMatcher.Builder addAllPath​(java.lang.Iterable<? extends StructMatcher.PathSegment> values)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • clearPath

        public StructMatcher.Builder clearPath()
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • removePath

        public StructMatcher.Builder removePath​(int index)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • getPathBuilder

        public StructMatcher.PathSegment.Builder getPathBuilder​(int index)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • addPathBuilder

        public StructMatcher.PathSegment.Builder addPathBuilder()
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • addPathBuilder

        public StructMatcher.PathSegment.Builder addPathBuilder​(int index)
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • getPathBuilderList

        public java.util.List<StructMatcher.PathSegment.Builder> getPathBuilderList()
         The path to retrieve the Value from the Struct.
         
        repeated .envoy.type.matcher.v3.StructMatcher.PathSegment path = 2 [(.validate.rules) = { ... }
      • hasValue

        public boolean hasValue()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
        Specified by:
        hasValue in interface StructMatcherOrBuilder
        Returns:
        Whether the value field is set.
      • getValue

        public ValueMatcher getValue()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
        Specified by:
        getValue in interface StructMatcherOrBuilder
        Returns:
        The value.
      • setValue

        public StructMatcher.Builder setValue​(ValueMatcher value)
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
      • setValue

        public StructMatcher.Builder setValue​(ValueMatcher.Builder builderForValue)
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
      • mergeValue

        public StructMatcher.Builder mergeValue​(ValueMatcher value)
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
      • clearValue

        public StructMatcher.Builder clearValue()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
      • getValueBuilder

        public ValueMatcher.Builder getValueBuilder()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
      • getValueOrBuilder

        public ValueMatcherOrBuilder getValueOrBuilder()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }
        Specified by:
        getValueOrBuilder in interface StructMatcherOrBuilder
      • getValueFieldBuilder

        private com.google.protobuf.SingleFieldBuilder<ValueMatcher,​ValueMatcher.Builder,​ValueMatcherOrBuilder> getValueFieldBuilder()
         The StructMatcher is matched if the value retrieved by path is matched to this value.
         
        .envoy.type.matcher.v3.ValueMatcher value = 3 [(.validate.rules) = { ... }