Package java.lang.reflect

Examples of java.lang.reflect.AccessibleObject


      JsValueGlue.set(jsValue, classLoader, field.getType(),
          javaDispatch.getFieldValue(dispId));
      return;
    } else {
      MethodAdaptor method = javaDispatch.getMethod(dispId);
      AccessibleObject obj = method.getUnderlyingObject();
      DispatchMethod64 dispMethod = (DispatchMethod64) classLoader.getWrapperForObject(obj);
      if (dispMethod == null) {
        dispMethod = new MethodDispatch64(classLoader, method);
        classLoader.putWrapperForObject(obj, dispMethod);
      }
View Full Code Here


      JsValueGlue.set(jsValue, classLoader, field.getType(),
          javaDispatch.getFieldValue(dispId));
      return;
    } else {
      MethodAdaptor method = javaDispatch.getMethod(dispId);
      AccessibleObject obj = method.getUnderlyingObject();
      DispatchMethod32/*64*/ dispMethod = (DispatchMethod32/*64*/) classLoader.getWrapperForObject(obj);
      if (dispMethod == null) {
        dispMethod = new MethodDispatch32/*64*/(classLoader, method);
        classLoader.putWrapperForObject(obj, dispMethod);
      }
View Full Code Here

          if ((flags & COM.DISPATCH_METHOD) != 0) {
            // This is a method call.
            return callMethod(classLoader, dispIdOracle, getTarget(), params, method);
          } else if (flags == COM.DISPATCH_PROPERTYGET) {
            // The function is being accessed as a property.
            AccessibleObject obj = method.getUnderlyingObject();
            IDispatchImpl dispMethod =
                (IDispatchImpl) WrappersCache.getWrapperForObject(classLoader, obj);
            if (dispMethod == null || dispMethod.refCount < 1) {
              dispMethod = new MethodDispatch(classLoader, dispIdOracle, method);
              WrappersCache.putWrapperForObject(classLoader, obj, dispMethod);
View Full Code Here

          try {
            toStringMethod = new MethodAdaptor(Object.class.getDeclaredMethod("toString"));
          } catch (Throwable e) {
            throw new RuntimeException("Failed to get Object.toString() method", e);
          }
          AccessibleObject obj = toStringMethod.getUnderlyingObject();
          IDispatchImpl dispMethod =
              (IDispatchImpl) WrappersCache.getWrapperForObject(classLoader, obj);
          if (dispMethod == null || dispMethod.refCount < 1) {
            dispMethod = new MethodDispatch(classLoader, dispIdOracle, toStringMethod);
            WrappersCache.putWrapperForObject(classLoader, obj, dispMethod);
View Full Code Here

   */
  public void test_isAccessible() {
    // Test for method boolean
    // java.lang.reflect.AccessibleObject.isAccessible()
    try {
      AccessibleObject ao = TestClass.class.getField("aField");
      ao.setAccessible(true);
      assertTrue("Returned false to isAccessible", ao.isAccessible());
      ao.setAccessible(false);
      assertTrue("Returned true to isAccessible", !ao.isAccessible());
    } catch (Exception e) {
      fail("Exception during test : " + e.getMessage());
    }
  }
View Full Code Here

  public void test_setAccessible$Ljava_lang_reflect_AccessibleObjectZ() {
    // Test for method void
    // java.lang.reflect.AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject
    // [], boolean)
    try {
      AccessibleObject ao = TestClass.class.getField("aField");
      AccessibleObject[] aoa = new AccessibleObject[] { ao };
      AccessibleObject.setAccessible(aoa, true);
      assertTrue("Returned false to isAccessible", ao.isAccessible());
      AccessibleObject.setAccessible(aoa, false);
      assertTrue("Returned true to isAccessible", !ao.isAccessible());
    } catch (Exception e) {
      fail("Exception during test : " + e.getMessage());
    }
  }
View Full Code Here

   *
   * @return True iff the attribute's Java Member is annotated with {@code ManyToMany},
   *         {@code ManyToOne}, {@code OneToMany}, or {@code OneToOne}.
   */
  private boolean isAssociation(SingularAttribute<?, ?> attr) {
    AccessibleObject member = (AccessibleObject) getJavaMember(attr);
    return (member.getAnnotation(ManyToMany.class) != null
        || member.getAnnotation(ManyToOne.class) != null
        || member.getAnnotation(OneToMany.class) != null || member.getAnnotation(OneToOne.class) != null);
  }
View Full Code Here

    if (!(javaMember instanceof AccessibleObject)) {
      Class<? extends Member> memberType = javaMember == null ? null : javaMember.getClass();
      throw new GenerationException(
          "Found a SingularAttribute whose Java Member is not a field or a method (it is a " + memberType + ")");
    }
    AccessibleObject member = (AccessibleObject) javaMember;

    if (member.getAnnotation(ManyToMany.class) != null) {
      ManyToMany anno = member.getAnnotation(ManyToMany.class);
      return anno.cascade();
    }
    if (member.getAnnotation(ManyToOne.class) != null) {
      ManyToOne anno = member.getAnnotation(ManyToOne.class);
      return anno.cascade();
    }
    if (member.getAnnotation(OneToMany.class) != null) {
      OneToMany anno = member.getAnnotation(OneToMany.class);
      return anno.cascade();
    }
    if (member.getAnnotation(OneToOne.class) != null) {
      OneToOne anno = member.getAnnotation(OneToOne.class);
      return anno.cascade();
    }

    // the member must not be a relationship (or at least not the owning side of one)
    return null;
View Full Code Here

   {
      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

      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

TOP

Related Classes of java.lang.reflect.AccessibleObject

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.