Record Class Metadata.FieldProperty<T>

java.lang.Object
java.lang.Record
org.elasticsearch.script.Metadata.FieldProperty<T>
Record Components:
type - - the class of the field. Updates must be assignable to this type. If null, no type checking is performed.
nullable - - can the field value be null and can it be removed
writable - - can the field be updated after the initial set
extendedValidation - - value validation after type checking, may be used for values that may be one of a set
Enclosing class:
Metadata

public static record Metadata.FieldProperty<T>(Class<T> type, boolean nullable, boolean writable, BiConsumer<String,T> extendedValidation) extends Record
The properties of a metadata field.
  • Field Details

  • Constructor Details

    • FieldProperty

      public FieldProperty(Class<T> type)
    • FieldProperty

      public FieldProperty(Class<T> type, boolean nullable, boolean writable, BiConsumer<String,T> extendedValidation)
      Creates an instance of a FieldProperty record class.
      Parameters:
      type - the value for the type record component
      nullable - the value for the nullable record component
      writable - the value for the writable record component
      extendedValidation - the value for the extendedValidation record component
  • Method Details

    • withNullable

      public Metadata.FieldProperty<T> withNullable()
    • withWritable

      public Metadata.FieldProperty<T> withWritable()
    • withValidation

      public Metadata.FieldProperty<T> withValidation(BiConsumer<String,T> extendedValidation)
    • check

      public void check(Metadata.MapOperation op, String key, Object value)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public Class<T> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • nullable

      public boolean nullable()
      Returns the value of the nullable record component.
      Returns:
      the value of the nullable record component
    • writable

      public boolean writable()
      Returns the value of the writable record component.
      Returns:
      the value of the writable record component
    • extendedValidation

      public BiConsumer<String,T> extendedValidation()
      Returns the value of the extendedValidation record component.
      Returns:
      the value of the extendedValidation record component