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
Modifier and TypeFieldDescriptionstatic Metadata.FieldProperty<?>
static BiConsumer<String,
Number> -
Constructor Summary
ConstructorDescriptionFieldProperty
(Class<T> type) FieldProperty
(Class<T> type, boolean nullable, boolean writable, BiConsumer<String, T> extendedValidation) Creates an instance of aFieldProperty
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
check
(Metadata.MapOperation op, String key, Object value) final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theextendedValidation
record component.final int
hashCode()
Returns a hash code value for this object.boolean
nullable()
Returns the value of thenullable
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.withValidation
(BiConsumer<String, T> extendedValidation) boolean
writable()
Returns the value of thewritable
record 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 aFieldProperty
record class.- Parameters:
type
- the value for thetype
record componentnullable
- the value for thenullable
record componentwritable
- the value for thewritable
record componentextendedValidation
- the value for theextendedValidation
record 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 thetype
record component.- Returns:
- the value of the
type
record component
-
nullable
public boolean nullable()Returns the value of thenullable
record component.- Returns:
- the value of the
nullable
record component
-
writable
public boolean writable()Returns the value of thewritable
record component.- Returns:
- the value of the
writable
record component
-
extendedValidation
Returns the value of theextendedValidation
record component.- Returns:
- the value of the
extendedValidation
record component
-