[
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-36?page=co...
]
Emmanuel Bernard commented on BVAL-36:
--------------------------------------
Not Design by Contract as this term is trademarked. But something approaching. This has
been a very popular request amongst users after the first draft. I do not plan to
introduce pre/post condition. Just parameter validation and returned type validation.
Validation of method parameters and returned values
---------------------------------------------------
Key: BVAL-36
URL:
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-36
Project: Bean Validation
Issue Type: New Feature
Components: spec-general
Reporter: Emmanuel Bernard
Assignee: Emmanuel Bernard
The goal is to expose the necessary APIs to validate method parameters and returned type.
This API can typically be used by an interceptor framework.
Validator {
List<IC> validateParameters(Method, Object[] parameterValues);
List<IC> validateParameter(Method, Object parameterValue, int parameterIndex);
List<IC> validateReturnedValue(Method, Object returnedValue);
List<IC> validateParameters(Constructor, Object[] parameterValues);
List<IC> validateParameter(Constructor, Object parameterValue, int
parameterIndex);
}
Metadata
Validator {
BeanDescriptor getConstraintsForBean()
PropertyDescriptor getConstraintsForProperty(String propertyName);
MethodDescriptor getConstraintsForMethod(Method);
MethodDescriptor getConstraintsForConstructor(Constructor);
String[] getValidatedProperties();
Method[] getValidatedMethods();
Constructor[] getValidatedConstructors();
}
ElementDescriptor {
ElementType getElementType();
Class getType();
List<ConstraintDescriptor> getConstraintDescriptors();
}
PropertyDescriptor extends ElementDescriptor {
boolean isCascaded();
String getPropertyPath();
}
ParameterDescriptor extends ElementDescriptor {
boolean isCascaded();
int getIndex();
}
BeanDescriptor extends ElementDescriptor {
}
MethodDescriptor extends ElementDescriptor {
List<ParameterDescriptor> getParameterDescriptors(); //index aligned
boolean isCascaded();
}
ConstructorDescriptor extends ElementDescriptor {
List<ParameterDescriptor> getParameterDescriptors(); //index aligned
}
How to read parameter annotations
Class<?> parameterTypes = method.getParameterTypes()
Annotation[][] parameterAnnotations = method.getParameterAnnotations()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira