Package org.elasticsearch.client
Class ValidationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.IllegalArgumentException
-
- org.elasticsearch.client.ValidationException
-
- All Implemented Interfaces:
Serializable
public class ValidationException extends IllegalArgumentException
Encapsulates an accumulation of validation errors- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ValidationException()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValidationError(String error)Add a new validation error to the accumulating validation errorsvoidaddValidationErrors(ValidationException exception)Adds validation errors from an existingValidationExceptionto the accumulating validation errorsStringgetMessage()List<String>validationErrors()Returns the validation errors accumulatedstatic ValidationExceptionwithError(String... error)CreatesValidationExceptioninstance initialized with given error messages.static ValidationExceptionwithErrors(List<String> errors)CreatesValidationExceptioninstance initialized with given error messages.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
withError
public static ValidationException withError(String... error)
CreatesValidationExceptioninstance initialized with given error messages.- Parameters:
error- the errors to add- Returns:
ValidationExceptioninstance
-
withErrors
public static ValidationException withErrors(List<String> errors)
CreatesValidationExceptioninstance initialized with given error messages.- Parameters:
errors- the list of errors to add- Returns:
ValidationExceptioninstance
-
addValidationError
public void addValidationError(String error)
Add a new validation error to the accumulating validation errors- Parameters:
error- the error to add
-
addValidationErrors
public final void addValidationErrors(@Nullable ValidationException exception)
Adds validation errors from an existingValidationExceptionto the accumulating validation errors- Parameters:
exception- theValidationExceptionto add errors from
-
validationErrors
public final List<String> validationErrors()
Returns the validation errors accumulated
-
getMessage
public final String getMessage()
- Overrides:
getMessagein classThrowable
-
-