Class GEValidator
java.lang.Object
net.mcreator.element.util.GEValidator
This class provides validation functionality for generatable elements and their fields.
It leverages reflection to inspect and validate fields recursively and attempts to
correct invalid values when possible based on attached annotations.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidValidates the given generatable element and recursively checks all nested custom objects, collections, maps, and arrays using reflection.
-
Constructor Details
-
GEValidator
public GEValidator()
-
-
Method Details
-
validateAndTryToCorrect
public static void validateAndTryToCorrect(GeneratableElement element) throws GEValidator.ValidationException Validates the given generatable element and recursively checks all nested custom objects, collections, maps, and arrays using reflection. Supported validation annotations: -Nonnull: field value must not benull(exception) -Numeric: numeric value must be within allowed bounds (tries to correct) -LimitedOptions: value must match one of the allowed options (tries to correct)- Parameters:
element- the element to validate- Throws:
GEValidator.ValidationException- if validation fails or reflective access fails
-