[hibernate-issues] [Hibernate-JIRA] Created: (BVAL-36) Validation of method parameters and returned values

Emmanuel Bernard (JIRA) noreply at atlassian.com
Fri Oct 10 14:29:06 EDT 2008


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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list