Module org.elasticsearch.server
Package org.elasticsearch.script
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 removedwritable- - can the field be updated after the initial setextendedValidation- - 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Metadata.FieldProperty<?> static final BiConsumer<String, Number> -
Constructor Summary
ConstructorsConstructorDescriptionFieldProperty(Class<T> type) FieldProperty(Class<T> type, boolean nullable, boolean writable, BiConsumer<String, T> extendedValidation) Creates an instance of aFieldPropertyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck(Metadata.MapOperation op, String key, Object value) final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextendedValidationrecord component.final inthashCode()Returns a hash code value for this object.booleannullable()Returns the value of thenullablerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.withValidation(BiConsumer<String, T> extendedValidation) booleanwritable()Returns the value of thewritablerecord component.
-
Field Details
-
LONGABLE_NUMBER
-
ALLOW_ALL
-
-
Constructor Details
-
FieldProperty
-
FieldProperty
public FieldProperty(Class<T> type, boolean nullable, boolean writable, BiConsumer<String, T> extendedValidation) Creates an instance of aFieldPropertyrecord class.- Parameters:
type- the value for thetyperecord componentnullable- the value for thenullablerecord componentwritable- the value for thewritablerecord componentextendedValidation- the value for theextendedValidationrecord component
-
-
Method Details
-
withNullable
-
withWritable
-
withValidation
-
check
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
nullable
public boolean nullable()Returns the value of thenullablerecord component.- Returns:
- the value of the
nullablerecord component
-
writable
public boolean writable()Returns the value of thewritablerecord component.- Returns:
- the value of the
writablerecord component
-
extendedValidation
Returns the value of theextendedValidationrecord component.- Returns:
- the value of the
extendedValidationrecord component
-