code: @SuppressWarnings("unchecked")
     public static <T> T enhance(Class<T> type, ForgeProxy handler)
     {
        Assert.notNull(type, "Class type to proxy must not be null");
        Assert.notNull(handler, "ForgeProxy handler must not be null");
  
        Object result = null;
  
        Class<?> proxyType = getCachedProxyType(type.getClassLoader(), type);
        if (proxyType == null)
        {
           Class<?>[] hierarchy = null;
           Class<?> superclass = null;
  
           if (type.isInterface() && !ForgeProxy.class.isAssignableFrom(type))
              hierarchy = new Class<?>[] { type, ForgeProxy.class };
           else if (type.isInterface())
              hierarchy = new Class<?>[] { type };
           else
           {
              if (Proxies.isProxyType(type))
                 superclass = unwrapProxyTypes(type);
              else
              {
                 superclass = type;
                 hierarchy = new Class<?>[] { ForgeProxy.class };
              }
           }
  
           ProxyFactory f = new ProxyFactory();
  
           f.setFilter(filter);
           f.setInterfaces(hierarchy);
           f.setSuperclass(superclass);
  
           proxyType = f.createClass();
           setCachedProxyType(type.getClassLoader(), type, proxyType);
        }
  
        try
        {
           result = proxyType.newInstance();
        }
        catch (InstantiationException e)
        {
           throw new IllegalStateException(
                    "Could not instantiate proxy for type [" + type
                             + "]. For optimal proxy compatibility, ensure " +
                             "that this type is an interface, or a class with a default constructor.",
                    e);
        }
        catch (IllegalAccessException e)
        {
           throw new IllegalStateException(e);
        }
  
        if (result instanceof Proxy)
           ((Proxy) result).setHandler(handler);
        else if (result instanceof ProxyObject)
           ((ProxyObject) result).setHandler(handler);
        else
           throw new IllegalStateException("Could not set proxy handler [" + handler + "] for proxy object ["
                    + result + "] for proxy of type [" + type + "]");
  
        return (T) result;
     }
docs: Create a proxy for the given {@link Class} type and {@link ForgeProxy} handler.