Package org.hibernate.validator.util

Examples of org.hibernate.validator.util.GetMethod


   *         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

    return new MetaConstraint<T, A>( beanClass, member, constraintDescriptor );
  }

  private <A extends Annotation> Class<?> getAnnotationParameterType(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 parameter " + name + "." );
    }
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

      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(
          "Overridden constraint does not define an attribute with name " + overridesAttribute.name()
      );
View Full Code Here

    return metaConstraint;
  }

  private <A extends Annotation> Class<?> getAnnotationParameterType(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 parameter " + 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(
          "Overridden 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

TOP

Related Classes of org.hibernate.validator.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.