Class FieldConstraints

  • All Implemented Interfaces:
    FieldConstraintsOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.io.Serializable

    public final class FieldConstraints
    extends com.google.protobuf.GeneratedMessage
    implements FieldConstraintsOrBuilder
     FieldRules encapsulates the rules for each type of field. Depending on the
     field, the correct set should be used to ensure proper validations.
     
    Protobuf type buf.validate.FieldConstraints
    See Also:
    Serialized Form
    • 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
      • getCelList

        public java.util.List<Constraint> getCelList()
         `cel` is a repeated field used to represent a textual expression
         in the Common Expression Language (CEL) syntax. For more information on
         CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
        
         ```proto
         message MyMessage {
         // The field `value` must be greater than 42.
         optional int32 value = 1 [(buf.validate.field).cel = {
         id: "my_message.value",
         message: "value must be greater than 42",
         expression: "this > 42",
         }];
         }
         ```
         
        repeated .buf.validate.Constraint cel = 23;
        Specified by:
        getCelList in interface FieldConstraintsOrBuilder
      • getCelOrBuilderList

        public java.util.List<? extends ConstraintOrBuilder> getCelOrBuilderList()
         `cel` is a repeated field used to represent a textual expression
         in the Common Expression Language (CEL) syntax. For more information on
         CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
        
         ```proto
         message MyMessage {
         // The field `value` must be greater than 42.
         optional int32 value = 1 [(buf.validate.field).cel = {
         id: "my_message.value",
         message: "value must be greater than 42",
         expression: "this > 42",
         }];
         }
         ```
         
        repeated .buf.validate.Constraint cel = 23;
        Specified by:
        getCelOrBuilderList in interface FieldConstraintsOrBuilder
      • getCelCount

        public int getCelCount()
         `cel` is a repeated field used to represent a textual expression
         in the Common Expression Language (CEL) syntax. For more information on
         CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
        
         ```proto
         message MyMessage {
         // The field `value` must be greater than 42.
         optional int32 value = 1 [(buf.validate.field).cel = {
         id: "my_message.value",
         message: "value must be greater than 42",
         expression: "this > 42",
         }];
         }
         ```
         
        repeated .buf.validate.Constraint cel = 23;
        Specified by:
        getCelCount in interface FieldConstraintsOrBuilder
      • getCel

        public Constraint getCel​(int index)
         `cel` is a repeated field used to represent a textual expression
         in the Common Expression Language (CEL) syntax. For more information on
         CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
        
         ```proto
         message MyMessage {
         // The field `value` must be greater than 42.
         optional int32 value = 1 [(buf.validate.field).cel = {
         id: "my_message.value",
         message: "value must be greater than 42",
         expression: "this > 42",
         }];
         }
         ```
         
        repeated .buf.validate.Constraint cel = 23;
        Specified by:
        getCel in interface FieldConstraintsOrBuilder
      • getCelOrBuilder

        public ConstraintOrBuilder getCelOrBuilder​(int index)
         `cel` is a repeated field used to represent a textual expression
         in the Common Expression Language (CEL) syntax. For more information on
         CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
        
         ```proto
         message MyMessage {
         // The field `value` must be greater than 42.
         optional int32 value = 1 [(buf.validate.field).cel = {
         id: "my_message.value",
         message: "value must be greater than 42",
         expression: "this > 42",
         }];
         }
         ```
         
        repeated .buf.validate.Constraint cel = 23;
        Specified by:
        getCelOrBuilder in interface FieldConstraintsOrBuilder
      • getSkipped

        public boolean getSkipped()
         `skipped` is an optional boolean attribute that specifies that the
         validation rules of this field should not be evaluated. If skipped is set to
         true, any validation rules set for the field will be ignored.
        
         ```proto
         message MyMessage {
         // The field `value` must not be set.
         optional MyOtherMessage value = 1 [(buf.validate.field).skipped = true];
         }
         ```
         
        bool skipped = 24;
        Specified by:
        getSkipped in interface FieldConstraintsOrBuilder
        Returns:
        The skipped.
      • getRequired

        public boolean getRequired()
         If `required` is true, the field must be populated. Field presence can be
         described as "serialized in the wire format," which follows the following rules:
        
         - the following "nullable" fields must be explicitly set to be considered present:
         - singular message fields (may be their empty value)
         - member fields of a oneof (may be their default value)
         - proto3 optional fields (may be their default value)
         - proto2 scalar fields
         - proto3 scalar fields must be non-zero to be considered present
         - repeated and map fields must be non-empty to be considered present
        
         ```proto
         message MyMessage {
         // The field `value` must be set to a non-null value.
         optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
         }
         ```
         
        bool required = 25;
        Specified by:
        getRequired in interface FieldConstraintsOrBuilder
        Returns:
        The required.
      • getIgnoreEmpty

        public boolean getIgnoreEmpty()
         If `ignore_empty` is true and applied to a non-nullable field (see
         `required` for more details), validation is skipped on the field if it is
         the default or empty value. Adding `ignore_empty` to a "nullable" field is
         a noop as these unset fields already skip validation (with the exception
         of `required`).
        
         ```proto
         message MyRepeated {
         // The field `value` min_len rule is only applied if the field isn't empty.
         repeated string value = 1 [
         (buf.validate.field).ignore_empty = true,
         (buf.validate.field).min_len = 5
         ];
         }
         ```
         
        bool ignore_empty = 26;
        Specified by:
        getIgnoreEmpty in interface FieldConstraintsOrBuilder
        Returns:
        The ignoreEmpty.
      • hasFloat

        public boolean hasFloat()
         Scalar Field Types
         
        .buf.validate.FloatRules float = 1;
        Specified by:
        hasFloat in interface FieldConstraintsOrBuilder
        Returns:
        Whether the float field is set.
      • hasDouble

        public boolean hasDouble()
        .buf.validate.DoubleRules double = 2;
        Specified by:
        hasDouble in interface FieldConstraintsOrBuilder
        Returns:
        Whether the double field is set.
      • hasInt32

        public boolean hasInt32()
        .buf.validate.Int32Rules int32 = 3;
        Specified by:
        hasInt32 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the int32 field is set.
      • hasInt64

        public boolean hasInt64()
        .buf.validate.Int64Rules int64 = 4;
        Specified by:
        hasInt64 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the int64 field is set.
      • hasUint32

        public boolean hasUint32()
        .buf.validate.UInt32Rules uint32 = 5;
        Specified by:
        hasUint32 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the uint32 field is set.
      • hasUint64

        public boolean hasUint64()
        .buf.validate.UInt64Rules uint64 = 6;
        Specified by:
        hasUint64 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the uint64 field is set.
      • hasSint32

        public boolean hasSint32()
        .buf.validate.SInt32Rules sint32 = 7;
        Specified by:
        hasSint32 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the sint32 field is set.
      • hasSint64

        public boolean hasSint64()
        .buf.validate.SInt64Rules sint64 = 8;
        Specified by:
        hasSint64 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the sint64 field is set.
      • hasFixed32

        public boolean hasFixed32()
        .buf.validate.Fixed32Rules fixed32 = 9;
        Specified by:
        hasFixed32 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the fixed32 field is set.
      • hasFixed64

        public boolean hasFixed64()
        .buf.validate.Fixed64Rules fixed64 = 10;
        Specified by:
        hasFixed64 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the fixed64 field is set.
      • hasSfixed32

        public boolean hasSfixed32()
        .buf.validate.SFixed32Rules sfixed32 = 11;
        Specified by:
        hasSfixed32 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the sfixed32 field is set.
      • hasSfixed64

        public boolean hasSfixed64()
        .buf.validate.SFixed64Rules sfixed64 = 12;
        Specified by:
        hasSfixed64 in interface FieldConstraintsOrBuilder
        Returns:
        Whether the sfixed64 field is set.
      • hasBool

        public boolean hasBool()
        .buf.validate.BoolRules bool = 13;
        Specified by:
        hasBool in interface FieldConstraintsOrBuilder
        Returns:
        Whether the bool field is set.
      • hasString

        public boolean hasString()
        .buf.validate.StringRules string = 14;
        Specified by:
        hasString in interface FieldConstraintsOrBuilder
        Returns:
        Whether the string field is set.
      • hasBytes

        public boolean hasBytes()
        .buf.validate.BytesRules bytes = 15;
        Specified by:
        hasBytes in interface FieldConstraintsOrBuilder
        Returns:
        Whether the bytes field is set.
      • hasEnum

        public boolean hasEnum()
         Complex Field Types
         
        .buf.validate.EnumRules enum = 16;
        Specified by:
        hasEnum in interface FieldConstraintsOrBuilder
        Returns:
        Whether the enum field is set.
      • hasRepeated

        public boolean hasRepeated()
        .buf.validate.RepeatedRules repeated = 18;
        Specified by:
        hasRepeated in interface FieldConstraintsOrBuilder
        Returns:
        Whether the repeated field is set.
      • hasMap

        public boolean hasMap()
        .buf.validate.MapRules map = 19;
        Specified by:
        hasMap in interface FieldConstraintsOrBuilder
        Returns:
        Whether the map field is set.
      • hasAny

        public boolean hasAny()
         Well-Known Field Types
         
        .buf.validate.AnyRules any = 20;
        Specified by:
        hasAny in interface FieldConstraintsOrBuilder
        Returns:
        Whether the any field is set.
      • hasDuration

        public boolean hasDuration()
        .buf.validate.DurationRules duration = 21;
        Specified by:
        hasDuration in interface FieldConstraintsOrBuilder
        Returns:
        Whether the duration field is set.
      • hasTimestamp

        public boolean hasTimestamp()
        .buf.validate.TimestampRules timestamp = 22;
        Specified by:
        hasTimestamp in interface FieldConstraintsOrBuilder
        Returns:
        Whether the timestamp field is set.
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws java.io.IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessage
        Throws:
        java.io.IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessage
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static FieldConstraints parseFrom​(java.nio.ByteBuffer data)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(java.nio.ByteBuffer data,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(com.google.protobuf.ByteString data)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(com.google.protobuf.ByteString data,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(byte[] data)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(byte[] data,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static FieldConstraints parseFrom​(java.io.InputStream input)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static FieldConstraints parseFrom​(java.io.InputStream input,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static FieldConstraints parseDelimitedFrom​(java.io.InputStream input)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • parseDelimitedFrom

        public static FieldConstraints parseDelimitedFrom​(java.io.InputStream input,
                                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static FieldConstraints parseFrom​(com.google.protobuf.CodedInputStream input)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFrom

        public static FieldConstraints parseFrom​(com.google.protobuf.CodedInputStream input,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • newBuilderForType

        public FieldConstraints.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • toBuilder

        public FieldConstraints.Builder toBuilder()
        Specified by:
        toBuilder in interface com.google.protobuf.Message
        Specified by:
        toBuilder in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected FieldConstraints.Builder newBuilderForType​(com.google.protobuf.AbstractMessage.BuilderParent parent)
        Overrides:
        newBuilderForType in class com.google.protobuf.AbstractMessage
      • getParserForType

        public com.google.protobuf.Parser<FieldConstraints> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessage
      • getDefaultInstanceForType

        public FieldConstraints getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder