Package org.hibernate.validator.util.privilegedactions

Examples of org.hibernate.validator.util.privilegedactions.GetDeclaredField


      throw new IllegalArgumentException( "Element type has to be FIELD or METHOD" );
    }

    Member member = null;
    if ( ElementType.FIELD.equals( elementType ) ) {
      GetDeclaredField action = GetDeclaredField.action( clazz, property );
      if ( System.getSecurityManager() != null ) {
        member = AccessController.doPrivileged( action );
      }
      else {
        member = action.run();
      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here


   * @param fieldName The field name.
   *
   * @return Returns the declared field with the specified name or {@code null} if it does not exist.
   */
  public static Field getDeclaredField(Class<?> clazz, String fieldName) {
    GetDeclaredField action = GetDeclaredField.action( clazz, fieldName );
    final Field field;
    if ( System.getSecurityManager() != null ) {
      field = AccessController.doPrivileged( action );
    }
    else {
      field = action.run();
    }
    return field;
  }
View Full Code Here

      throw new IllegalArgumentException( "Element type has to be FIELD or METHOD" );
    }

    Member member = null;
    if ( ElementType.FIELD.equals( elementType ) ) {
      GetDeclaredField action = GetDeclaredField.action( clazz, property );
      if ( System.getSecurityManager() != null ) {
        member = AccessController.doPrivileged( action );
      }
      else {
        member = action.run();
      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here

   * @param fieldName The field name.
   *
   * @return Returns the declared field with the specified name or {@code null} if it does not exist.
   */
  public static Field getDeclaredField(Class<?> clazz, String fieldName) {
    GetDeclaredField action = GetDeclaredField.action( clazz, fieldName );
    final Field field;
    if ( System.getSecurityManager() != null ) {
      field = AccessController.doPrivileged( action );
    }
    else {
      field = action.run();
    }
    return field;
  }
View Full Code Here

      throw new IllegalArgumentException( "Element type has to be FIELD or METHOD" );
    }

    Member member = null;
    if ( ElementType.FIELD.equals( elementType ) ) {
      GetDeclaredField action = GetDeclaredField.action( clazz, property );
      if ( System.getSecurityManager() != null ) {
        member = AccessController.doPrivileged( action );
      }
      else {
        member = action.run();
      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      String[] prefixes = { "is", "get", "has" };
      for ( String prefix : prefixes ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here

   * @param fieldName The field name.
   *
   * @return Returns the field with the specified name or <code>null</code> if it does not exist.
   */
  public static Field getField(Class<?> clazz, String fieldName) {
    GetDeclaredField action = GetDeclaredField.action( clazz, fieldName );
    final Field field;
    if ( System.getSecurityManager() != null ) {
      field = AccessController.doPrivileged( action );
    }
    else {
      field = action.run();
    }
    return field;
  }
View Full Code Here

      throw new IllegalArgumentException( "Element type has to be FIELD or METHOD" );
    }

    Member member = null;
    if ( ElementType.FIELD.equals( elementType ) ) {
      GetDeclaredField action = GetDeclaredField.action( clazz, property );
      if ( System.getSecurityManager() != null ) {
        member = AccessController.doPrivileged( action );
      }
      else {
        member = action.run();
      }
    }
    else {
      String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 );
      for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) {
        GetMethod action = GetMethod.action( clazz, prefix + methodName );
        if ( System.getSecurityManager() != null ) {
          member = AccessController.doPrivileged( action );
        }
        else {
          member = action.run();
        }
        if ( member != null ) {
          break;
        }
      }
View Full Code Here

   * @param fieldName The field name.
   *
   * @return Returns the field with the specified name or <code>null</code> if it does not exist.
   */
  public static Field getField(Class<?> clazz, String fieldName) {
    GetDeclaredField action = GetDeclaredField.action( clazz, fieldName );
    final Field field;
    if ( System.getSecurityManager() != null ) {
      field = AccessController.doPrivileged( action );
    }
    else {
      field = action.run();
    }
    return field;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.util.privilegedactions.GetDeclaredField

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.