예제 #1
0
파일: Dom.java 프로젝트: hk2-project/hk2
  /**
   * Invoke the user defined static method in the nested "Duck" class so that the user can define
   * convenience methods on the config beans.
   */
  Object invokeDuckMethod(Method method, Object proxy, Object[] args) throws Exception {
    Method duckMethod = model.getDuckMethod(method);

    Object[] duckArgs;
    if (args == null) {
      duckArgs = new Object[] {proxy};
    } else {
      duckArgs = new Object[args.length + 1];
      duckArgs[0] = proxy;
      System.arraycopy(args, 0, duckArgs, 1, args.length);
    }

    try {
      return duckMethod.invoke(null, duckArgs);
    } catch (InvocationTargetException e) {
      Throwable t = e.getTargetException();
      if (t instanceof Exception) throw (Exception) t;
      if (t instanceof Error) throw (Error) t;
      throw e;
    }
  }
예제 #2
0
파일: Dom.java 프로젝트: hk2-project/hk2
    @Override
    public ConfigBeanProxy compute(final Class<?> proxyType) throws ComputationErrorException {

      ClassLoader cl;
      if (System.getSecurityManager() != null) {
        cl =
            AccessController.doPrivileged(
                new PrivilegedAction<ClassLoader>() {
                  @Override
                  public ClassLoader run() {
                    return proxyType.getClassLoader();
                  }
                });
      } else {
        cl = proxyType.getClassLoader();
      }

      ConfigBeanProxy retVal =
          (ConfigBeanProxy) Proxy.newProxyInstance(cl, new Class[] {proxyType}, dom);

      return retVal;
    }
예제 #3
0
파일: Dom.java 프로젝트: hk2-project/hk2
 public int hashCode() {
   return System.identityHashCode(this);
 }
예제 #4
0
파일: Dom.java 프로젝트: hk2-project/hk2
 @Override
 public String toString() {
   return "Dom.Child(" + name + "," + System.identityHashCode(this) + ")";
 }