public static BuildMetaClass makeProxy(String proxyClassName, MetaClass toProxy) {
ClassStructureBuilder builder;
if (!toProxy.isInterface()) {
if (toProxy.isFinal()) {
throw new UnproxyableClassException(toProxy, toProxy.getFullyQualifiedName()
+ " is an unproxiable class because it is final");
}
if (!toProxy.isDefaultInstantiable()) {
throw new UnproxyableClassException(toProxy, toProxy.getFullyQualifiedName() + " must have a default " +
"no-arg constructor");
}
builder = ClassBuilder.define(proxyClassName, toProxy).publicScope().body();
}