Package org.hibernate.validation.util

Examples of org.hibernate.validation.util.GetMethod


    return metaConstraint;
  }

  private <A extends Annotation> Class<?> getAnnotationParamterType(Class<A> annotationClass, String name) {
    Method m;
    GetMethod action = GetMethod.action( annotationClass, name );
    if ( System.getSecurityManager() != null ) {
      m = AccessController.doPrivileged( action );
    }
    else {
      m = action.run();
    }

    if ( m == null ) {
      throw new ValidationException( "Annotation of type " + annotationClass.getName() + " does not contain a paramter " + name + "." );
    }
View Full Code Here


      map.put( overridesAttribute.name(), value );
    }
  }

  private void ensureAttributeIsOverridable(Method m, OverridesAttribute overridesAttribute) {
    final GetMethod getMethod = GetMethod.action( overridesAttribute.constraint(), overridesAttribute.name() );
    final Method method;
    if ( System.getSecurityManager() != null ) {
      method = AccessController.doPrivileged( getMethod );
    }
    else {
      method = getMethod.run();
    }
    if (method == null) {
      throw new ConstraintDefinitionException(
          "Overriden constraint does not define an attribute with name " + overridesAttribute.name()
      );
View Full Code Here

   *         otherwise.
   */
  public boolean isMultiValueConstraint(Annotation annotation) {
    boolean isMultiValueConstraint = false;
    try {
      final GetMethod getMethod = GetMethod.action( annotation.getClass(), "value" );
      final Method method;
      if ( System.getSecurityManager() != null ) {
        method = AccessController.doPrivileged( getMethod );
      }
      else {
        method = getMethod.run();
      }
      if (method != null) {
        Class returnType = method.getReturnType();
        if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
          Annotation[] annotations = ( Annotation[] ) method.invoke( annotation );
View Full Code Here

   *         annotation.
   */
  public <A extends Annotation> List<Annotation> getMultiValueConstraints(A annotation) {
    List<Annotation> annotationList = new ArrayList<Annotation>();
    try {
      final GetMethod getMethod = GetMethod.action( annotation.getClass(), "value" );
      final Method method;
      if ( System.getSecurityManager() != null ) {
        method = AccessController.doPrivileged( getMethod );
      }
      else {
        method = getMethod.run();
      }
      if (method != null) {
        Class returnType = method.getReturnType();
        if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
          Annotation[] annotations = ( Annotation[] ) method.invoke( annotation );
View Full Code Here

    }
  }

  private void assertPayloadParameterExists(Annotation annotation) {
    try {
      final GetMethod getMethod = GetMethod.action( annotation.annotationType(), "payload" );
      final Method method;
      if ( System.getSecurityManager() != null ) {
        method = AccessController.doPrivileged( getMethod );
      }
      else {
        method = getMethod.run();
      }
      if (method == null) {
        String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
          "not contain a payload parameter.";
        throw new ConstraintDefinitionException( msg );
View Full Code Here

    }
  }

  private void assertGroupsParameterExists(Annotation annotation) {
    try {
      final GetMethod getMethod = GetMethod.action( annotation.annotationType(), "groups" );
      final Method method;
      if ( System.getSecurityManager() != null ) {
        method = AccessController.doPrivileged( getMethod );
      }
      else {
        method = getMethod.run();
      }
      if (method == null) {
        String msg = annotation.annotationType().getName() + " contains Constraint annotation, but does " +
          "not contain a groups parameter.";
        throw new ConstraintDefinitionException( msg );
View Full Code Here

TOP

Related Classes of org.hibernate.validation.util.GetMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.