/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a signed jar file. * * @see #toClass(ClassFile,Class,ClassLoader,ProtectionDomain) * @deprecated */ public static Class<?> toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, null, loader, null); }
/** Writes the class file to the classpath and returns a class object */ public Class<?> saveClass() { ClassFile classFile = ctClass.getClassFile(); try { if (!extraClassPath.exists()) { extraClassPath.mkdirs(); } FactoryHelper.writeFile(classFile, extraClassPath.getPath()); ClassLoader loader = getClass().getClassLoader(); Class<?> cls = FactoryHelper.toClass(classFile, loader); return cls; // load class } catch (Exception e) { throw new RuntimeException(e); } }
private void createClass3(ClassLoader cl) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
private void createClass3(ClassLoader cl, Lookup lookup) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); if (lookup == null) thisClass = FactoryHelper.toClass(cf, getClassInTheSamePackage(), cl, getDomain()); else thisClass = FactoryHelper.toClass(cf, lookup); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
BulkAccessor create() { final Method[] getters = new Method[getterNames.length]; final Method[] setters = new Method[setterNames.length]; findAccessors( targetBean, getterNames, setterNames, types, getters, setters ); final Class beanClass; try { final ClassFile classfile = make( getters, setters ); final ClassLoader loader = this.getClassLoader(); if ( writeDirectory != null ) { FactoryHelper.writeFile( classfile, writeDirectory ); } beanClass = FactoryHelper.toClass( classfile, null, loader, getDomain() ); return (BulkAccessor) this.newInstance( beanClass ); } catch ( Exception e ) { throw new BulkAccessorException( e.getMessage(), e ); } }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
/** * Loads a class file by a given class loader. * This method uses a default protection domain for the class * but it may not work with a security manager or a sigend jar file. * * @see #toClass(ClassFile,ClassLoader,ProtectionDomain) */ public static Class toClass(ClassFile cf, ClassLoader loader) throws CannotCompileException { return toClass(cf, loader, null); }
private void createClass3(ClassLoader cl) { try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(DEFAULT_INTERCEPTOR, handler); setField(METHOD_FILTER_FIELD, methodFilter); } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
private void createClass3(ClassLoader cl) { try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(DEFAULT_INTERCEPTOR, handler); setField(METHOD_FILTER_FIELD, methodFilter); } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
BulkAccessor create() { Method[] getters = new Method[getterNames.length]; Method[] setters = new Method[setterNames.length]; findAccessors( targetBean, getterNames, setterNames, types, getters, setters ); Class beanClass; try { ClassFile classfile = make( getters, setters ); ClassLoader loader = this.getClassLoader(); if ( writeDirectory != null ) { FactoryHelper.writeFile( classfile, writeDirectory ); } beanClass = FactoryHelper.toClass( classfile, loader, getDomain() ); return ( BulkAccessor ) this.newInstance( beanClass ); } catch ( Exception e ) { throw new BulkAccessorException( e.getMessage(), e ); } }
BulkAccessor create() { Method[] getters = new Method[getterNames.length]; Method[] setters = new Method[setterNames.length]; findAccessors( targetBean, getterNames, setterNames, types, getters, setters ); Class beanClass; try { ClassFile classfile = make( getters, setters ); ClassLoader loader = this.getClassLoader(); if ( writeDirectory != null ) { FactoryHelper.writeFile( classfile, writeDirectory ); } beanClass = FactoryHelper.toClass( classfile, loader, getDomain() ); return ( BulkAccessor ) this.newInstance( beanClass ); } catch ( Exception e ) { throw new BulkAccessorException( e.getMessage(), e ); } }
BulkAccessor create() { Method[] getters = new Method[getterNames.length]; Method[] setters = new Method[setterNames.length]; findAccessors( targetBean, getterNames, setterNames, types, getters, setters ); Class beanClass; try { ClassFile classfile = make( getters, setters ); ClassLoader loader = this.getClassLoader(); if ( writeDirectory != null ) { FactoryHelper.writeFile( classfile, writeDirectory ); } beanClass = FactoryHelper.toClass( classfile, loader, getDomain() ); return ( BulkAccessor ) this.newInstance( beanClass ); } catch ( Exception e ) { throw new BulkAccessorException( e.getMessage(), e ); } }
private void createClass3(ClassLoader cl) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
private void createClass3(ClassLoader cl) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
private void createClass3(ClassLoader cl) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }
private void createClass3(ClassLoader cl) { // we need a new class so we need a new class name allocateClassName(); try { ClassFile cf = make(); if (writeDirectory != null) FactoryHelper.writeFile(cf, writeDirectory); thisClass = FactoryHelper.toClass(cf, cl, getDomain()); setField(FILTER_SIGNATURE_FIELD, signature); // legacy behaviour : we only set the default interceptor static field if we are not using the cache if (!factoryUseCache) { setField(DEFAULT_INTERCEPTOR, handler); } } catch (CannotCompileException e) { throw new RuntimeException(e.getMessage(), e); } }