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 void
addValidationError(java.lang.String error)
Add a new validation error to the accumulating validation errorsvoid
addValidationErrors(ValidationException exception)
Adds validation errors from an existingValidationException
to the accumulating validation errorsjava.lang.String
getMessage()
java.util.List<java.lang.String>
validationErrors()
Returns the validation errors accumulatedstatic ValidationException
withError(java.lang.String... error)
CreatesValidationException
instance initialized with given error messages.static ValidationException
withErrors(java.util.List<java.lang.String> errors)
CreatesValidationException
instance initialized with given error messages.
-
Constructor Details
-
ValidationException
public ValidationException()
-
-
Method Details
-
withError
CreatesValidationException
instance initialized with given error messages.- Parameters:
error
- the errors to add- Returns:
ValidationException
instance
-
withErrors
CreatesValidationException
instance initialized with given error messages.- Parameters:
errors
- the list of errors to add- Returns:
ValidationException
instance
-
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 existingValidationException
to the accumulating validation errors- Parameters:
exception
- theValidationException
to 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:
getMessage
in classjava.lang.Throwable
-