Examples of AccessibleObject


Examples of java.lang.reflect.AccessibleObject

   {
      for (Injector injector : injectors)
      {
         if (injector instanceof JndiPropertyInjector)
         {
            AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();
           
            if (field.isAnnotationPresent(javax.ejb.EJB.class))
            {
               continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
            }
           
            if (field instanceof Field)
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

   {
      for (Injector injector : injectors)
      {
         if (injector instanceof JndiPropertyInjector)
         {
            AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();

            if (field.isAnnotationPresent(javax.ejb.EJB.class))
            {
               continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
            }

            if (field instanceof Field)
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

      if (!encName.startsWith("env/"))
      {
         encName = "env/" + encName;
      }

      AccessibleObject accObj = property.getAccessibleObject();

      Class<?> type = property.getType();
      if (!ref.type().equals(Object.class))
      {
         type = ref.type();
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

   {
      for (Injector injector : injectors)
      {
         if (injector instanceof JndiPropertyInjector)
         {
            AccessibleObject field = ((JndiPropertyInjector) injector).getAccessibleObject();

            if (field.isAnnotationPresent(javax.ejb.EJB.class))
            {
               continue; // skip nested EJB injection since the local proxy will be (de)serialized correctly
            }

            if (field instanceof Field)
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

     ===================================================================*/
  public Object setup(Map context, Object target, Member member, String propertyName) {
    Object result = null;

    if (isAccessible(context, target, member, propertyName)) {
      AccessibleObject accessible = (AccessibleObject) member;

      if (!accessible.isAccessible()) {
        result = Boolean.TRUE;
        accessible.setAccessible(true);
      }
    }
    return result;
  }
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

   *         given element.
   */
  private ConstrainedExecutable findExecutableMetaData(ExecutableElement executable) {
    List<ConstrainedParameter> parameterConstraints = getParameterMetaData( executable );

    AccessibleObject member = executable.getAccessibleObject();

    Map<ConstraintType, List<ConstraintDescriptorImpl<?>>> executableConstraints = partition(
        findConstraints(
            executable.getMember(),
            executable.getElementType()
        ), byType()
    );

    Set<MetaConstraint<?>> crossParameterConstraints;
    if ( annotationProcessingOptions.areMemberConstraintsIgnoredFor( executable.getMember() ) ) {
      crossParameterConstraints = Collections.emptySet();
    }
    else {
      crossParameterConstraints = convertToMetaConstraints(
          executableConstraints.get( ConstraintType.CROSS_PARAMETER ),
          executable
      );
    }

    Set<MetaConstraint<?>> returnValueConstraints;
    Map<Class<?>, Class<?>> groupConversions;
    boolean isCascading;
    if ( annotationProcessingOptions.areReturnValueConstraintsIgnoredFor( executable.getMember() ) ) {
      returnValueConstraints = Collections.emptySet();
      groupConversions = Collections.emptyMap();
      isCascading = false;
    }
    else {
      returnValueConstraints = convertToMetaConstraints(
          executableConstraints.get( ConstraintType.GENERIC ),
          executable
      );
      groupConversions = getGroupConversions(
          member.getAnnotation( ConvertGroup.class ),
          member.getAnnotation( ConvertGroup.List.class )
      );
      isCascading = executable.getAccessibleObject().isAnnotationPresent( Valid.class );
    }

    return new ConstrainedExecutable(
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

      }

      AccessibleObject[] objects =
  new AccessibleObject[] {constructor, field, method};

      AccessibleObject class_constructor =
  Class.class.getDeclaredConstructors()[0];

      Permission[] suppressAccessChecks = new Permission[] {
   new ReflectPermission("suppressAccessChecks")};

      TestSecurityManager sm = new TestSecurityManager(harness);
      try {
  sm.install();

  // throwpoint: java.lang.reflect.AccessibleObject-setAccessible(boolean)
  harness.checkPoint("setAccessible (per-object)");
  for (int i = 0; i < objects.length; i++) {
    try {
      sm.prepareChecks(suppressAccessChecks);
      objects[i].setAccessible(true);
      sm.checkAllChecked();
    }
    catch (SecurityException ex) {
      harness.debug(ex);
      harness.check(false, "unexpected check");
    }
  }

  harness.checkPoint("setAccessible (class constructor)");
  try {
    sm.prepareChecks(suppressAccessChecks);
    class_constructor.setAccessible(true);
    harness.check(false);
  }
  catch (SecurityException ex) {
    sm.checkAllChecked();
  }
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

     * @return the return object of the call to the static method or the value of the static constant
     * @throws Throwable if failed to invoke the static method or get the static constant value for any reason (Java JNI
     *                   jar not available, native library not available, etc)
     */
    private static final Object invokeApi(NativeApi api, Object... args) throws Throwable {
        AccessibleObject accessibleObject = nativeApis.get(api);

        if (accessibleObject instanceof Method) {
            return ((Method) accessibleObject).invoke(null, args);
        } else {
            return ((Field) accessibleObject).get(null);
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "looking for method {0}({1})",
                        new Object[]{methodName, argSignature(arguments)});
            }
            for (int i = 0; i < accessibleObjects.size(); i++) {
                AccessibleObject accessibleObject = (AccessibleObject) accessibleObjects.get(i);
                Class[] parameterTypes = null;
                if (accessibleObject instanceof Method) {
                    parameterTypes = ((Method) accessibleObject).getParameterTypes();
                } else if (accessibleObject instanceof Constructor) {
                    parameterTypes = ((Constructor) accessibleObject).getParameterTypes();
                }

                try {
                    final AccessibleObjectCandidate candidate = tryUnmarshallArgs(
                            accessibleObject, arguments,
                            parameterTypes, serializer);
                    if (null != candidate) {
                        candidates.add(candidate);
                        if (logger.isLoggable(Level.FINE)) {
                            logger.log(Level.FINE,
                                    "+++ possible match with method {0}({1})",
                                    new Object[]{methodName, argSignature(accessibleObject)});
                        }
                    }
                } catch (Exception e) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE,
                                "xxx {0} in {1}({2})",
                                new Object[]{e.getMessage(), methodName, argSignature(accessibleObject)});
                    }
                }
            }
            // now search through all the candidates and find one which matches
            // the json arguments the closest
            AccessibleObjectCandidate best = null;
            for (int i = 0; i < candidates.size(); i++) {
                AccessibleObjectCandidate c = (AccessibleObjectCandidate) candidates.get(i);
                if (best == null) {
                    best = c;
                    continue;
                }
                final ObjectMatch bestMatch = best.getMatch();
                final ObjectMatch cMatch = c.getMatch();
                if (bestMatch.getMismatch() > cMatch.getMismatch()) {
                    best = c;
                } else if (bestMatch.getMismatch() == cMatch.getMismatch()) {
                    best = betterSignature(best, c);
                }
            }
            if (best != null) {
                AccessibleObject ao = best.getAccessibleObject();
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "found method {0}({1})",
                            new Object[]{methodName, argSignature(ao)});
                }
                return ao;
View Full Code Here

Examples of java.lang.reflect.AccessibleObject

        // #5: Get the object to act upon and the possible method that could be
        // called on it
        final Map methodMap;
        final Object javascriptObject;
        final AccessibleObject ao;
        try {
            javascriptObject = this.getObjectContext(objectID, className);
            if(null==javascriptObject){
                throw new NoSuchMethodException(JSONRPCResult.MSG_ERR_NOSERVICE);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.