try {
final Method method = ReflectionHelper.getMethod( annotationType, "payload" );
if ( method == null ) {
String msg = annotationType.getName() + " contains Constraint annotation, but does " +
"not contain a payload parameter.";
throw new ConstraintDefinitionException( msg );
}
Class<?>[] defaultPayload = ( Class<?>[] ) method.getDefaultValue();
if ( defaultPayload.length != 0 ) {
String msg = annotationType
.getName() + " contains Constraint annotation, but the payload " +
"parameter default value is not the empty array.";
throw new ConstraintDefinitionException( msg );
}
}
catch ( ClassCastException e ) {
String msg = annotationType.getName() + " contains Constraint annotation, but the " +
"payload parameter is of wrong type.";
throw new ConstraintDefinitionException( msg );
}
}