org.hibernate.validator.method
Interface MethodConstraintViolation<T>

All Superinterfaces:
ConstraintViolation<T>
All Known Implementing Classes:
MethodConstraintViolationImpl

public interface MethodConstraintViolation<T>
extends ConstraintViolation<T>

Describes the violation of a method-level constraint by providing access to the method/parameter hosting the violated constraint etc.

Author:
Gunnar Morling
See Also:
MethodValidator

Nested Class Summary
static class MethodConstraintViolation.Kind
          The kind of a MethodConstraintViolation.
 
Method Summary
 MethodConstraintViolation.Kind getKind()
          Returns the kind of this method constraint violation.
 Method getMethod()
          Returns the method during which's validation this constraint violation occurred.
 Integer getParameterIndex()
          Returns the index of the parameter holding the constraint which caused this constraint violation.
 String getParameterName()
           Returns the name of the parameter holding the constraint which caused this constraint violation.
 
Methods inherited from interface javax.validation.ConstraintViolation
getConstraintDescriptor, getInvalidValue, getLeafBean, getMessage, getMessageTemplate, getPropertyPath, getRootBean, getRootBeanClass
 

Method Detail

getMethod

Method getMethod()
Returns the method during which's validation this constraint violation occurred.

Returns:
The method during which's validation this constraint violation occurred.

getParameterIndex

Integer getParameterIndex()
Returns the index of the parameter holding the constraint which caused this constraint violation.

Returns:
The index of the parameter holding the constraint which caused this constraint violation or null if this constraint violation is not of MethodConstraintViolation.Kind.PARAMETER.

getParameterName

String getParameterName()

Returns the name of the parameter holding the constraint which caused this constraint violation.

Currently a synthetic name following the form "arg" + index will be returned, e.g. "arg0". In future versions it might be possible to specify real parameter names, e.g. using an annotation-based approach around javax.inject.Named.

Returns:
The name of the parameter holding the constraint which caused this constraint violation or null if this constraint violation is not of MethodConstraintViolation.Kind.PARAMETER.

getKind

MethodConstraintViolation.Kind getKind()
Returns the kind of this method constraint violation.

Returns:
The kind of this method constraint violation.


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved