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:
java.io.Serializable
public class ValidationException
extends java.lang.IllegalArgumentException
Encapsulates an accumulation of validation errors
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ValidationException() -
Method Summary
Modifier and Type Method Description voidaddValidationError(java.lang.String error)Add a new validation error to the accumulating validation errorsvoidaddValidationErrors(ValidationException exception)Adds validation errors from an existingValidationExceptionto the accumulating validation errorsjava.lang.StringgetMessage()java.util.List<java.lang.String>validationErrors()Returns the validation errors accumulatedstatic ValidationExceptionwithError(java.lang.String... error)CreatesValidationExceptioninstance initialized with given error messages.static ValidationExceptionwithErrors(java.util.List<java.lang.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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
ValidationException
public ValidationException()
-
-
Method Details
-
withError
CreatesValidationExceptioninstance initialized with given error messages.- Parameters:
error- the errors to add- Returns:
ValidationExceptioninstance
-
withErrors
CreatesValidationExceptioninstance initialized with given error messages.- Parameters:
errors- the list of errors to add- Returns:
ValidationExceptioninstance
-
addValidationError
public void addValidationError(java.lang.String error)Add a new validation error to the accumulating validation errors- Parameters:
error- the error to add
-
addValidationErrors
Adds validation errors from an existingValidationExceptionto the accumulating validation errors- Parameters:
exception- theValidationExceptionto add errors from
-
validationErrors
public final java.util.List<java.lang.String> validationErrors()Returns the validation errors accumulated -
getMessage
public final java.lang.String getMessage()- Overrides:
getMessagein classjava.lang.Throwable
-