Record Class AugmentedAnnotation
java.lang.Object
java.lang.Record
org.elasticsearch.painless.spi.annotation.AugmentedAnnotation
Use an augmented annotation to augment a class to have available
a static final field from a different class.
Example:
// Whitelist
...
class java.lang.Integer {
...
}
class Augmented {
int MAX_VALUE @augmented[augmented_canonical_class_name="java.lang.Integer"]
int MIN_VALUE @augmented[augmented_canonical_class_name="java.lang.Integer"]
}
...
// Script
...
long value = <some_value>;
int augmented = 0;
if (value < Augmented.MAX_VALUE && value > Augmented.MIN_VALUE) {
augmented = (int)value;
}
...
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAugmentedAnnotation(String augmentedCanonicalClassName) Creates an instance of aAugmentedAnnotationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaugmentedCanonicalClassNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
AugmentedAnnotation
Creates an instance of aAugmentedAnnotationrecord class.- Parameters:
augmentedCanonicalClassName- the value for theaugmentedCanonicalClassNamerecord component
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
augmentedCanonicalClassName
Returns the value of theaugmentedCanonicalClassNamerecord component.- Returns:
- the value of the
augmentedCanonicalClassNamerecord component
-