[
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-36?page=co...
]
Hardy Ferentschik commented on BVAL-36:
---------------------------------------
Is the aim to make Bean Validation some sort of Design by Contract (DbC) framework similar
to iContract, jContractor or Contract4J? The latter also being based on annotations. How
would the annotations look like for method contraints? Would you introduce the pre/post
condition annotation into Bean Validation?
I am not sure whether this belongs into Bean 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