public Object getValue(Object ctx) {
   IGosuClass gsClass = (IGosuClass) getContainer().getOwnersType();
   try {
     Field field = gsClass.getBackingClass().getDeclaredField(_strIdentifer);
     field.setAccessible(true);
     return field.get(ctx);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
 public void setValue(Object ctx, Object value) {
   IGosuClass gsClass = _gosuClass;
   try {
     Field field = gsClass.getBackingClass().getDeclaredField(_strIdentifer);
     field.setAccessible(true);
     field.set(ctx, value);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 3
0
  private IGosuClass createJavaProxyImmediately(IJavaTypeInternal type) {
    IGosuClassInternal gsAdapterClass;

    if (type.getEnclosingType() != null) {
      // Ensure enclosing type is proxied; it contains the gosu source for the inner type
      IGosuClass outerProxy =
          (IGosuClass)
              TypeSystem.getByFullName(
                  getProxyName((IJavaType) TypeLord.getOuterMostEnclosingClass(type)));
      outerProxy.getInnerClasses();
      if (!outerProxy.isCompilingDeclarations()) {
        gsAdapterClass =
            (IGosuClassInternal)
                outerProxy.getInnerClass(
                    type.getRelativeName().substring(type.getRelativeName().indexOf('.') + 1));
        if (gsAdapterClass == null) {
          TypeSystem.refresh((ITypeRef) outerProxy, true);
          gsAdapterClass =
              (IGosuClassInternal)
                  outerProxy.getInnerClass(
                      type.getRelativeName().substring(type.getRelativeName().indexOf('.') + 1));
        }
      } else {
        return null;
      }
    } else {
      if (type.isInterface()) {
        gsAdapterClass = (IGosuClassInternal) createJavaInterfaceProxy(type);
      } else {
        gsAdapterClass = (IGosuClassInternal) createJavaClassProxy(type);
      }
    }

    type.setAdapterClass(gsAdapterClass);

    gsAdapterClass.setJavaType(type);
    return gsAdapterClass;
  }