/** * Adds additional controlled packages, in which classes are loaded and transformed. */ public PlasticManagerBuilder packages(Collection<String> packageNames) { check(); packages.addAll(packageNames); return this; }
/** * Invoked at object creation, or when there are updates to class files (i.e., invalidation), to create a new set of * Javassist class pools and loaders. */ private void initializeService() { PlasticManagerBuilder builder = PlasticManager.withClassLoader(parent).delegate(this) .packages(controlledPackageNames); if (!productionMode) { builder.enable(TransformationOption.FIELD_WRITEBEHIND); } manager = builder.create(); manager.addPlasticClassListener(this); proxyFactory = new PlasticProxyFactoryImpl(manager, logger); classToInstantiator.clear(); classToModel.clear(); }
public PlasticProxyFactoryImpl(ClassLoader parentClassLoader, Logger logger) { this(PlasticManager.withClassLoader(parentClassLoader).create(), logger); }
/** * Sets the {@link PlasticManagerDelegate}, which is ultimately responsible for * transforming classes loaded from controlled packages. The default delegate * does nothing. */ public PlasticManagerBuilder delegate(PlasticManagerDelegate delegate) { assert delegate != null; check(); this.delegate = delegate; return this; }
/** * Creates the PlasticManager with the current set of options. * * @return the PlasticManager */ public PlasticManager create() { lock(); return new PlasticManager(loader, delegate, packages, options); } }
/** Creates a new builder using the specified class loader. */ public static PlasticManagerBuilder withClassLoader(ClassLoader loader) { return new PlasticManagerBuilder(loader); }
/** * Creates the PlasticManager with the current set of options. * * @return the PlasticManager */ public PlasticManager create() { lock(); return new PlasticManager(loader, delegate, packages, options); } }
public PlasticManagerBuilder enable(TransformationOption option) { check(); options.add(option); return this; }
/** * Sets the {@link PlasticManagerDelegate}, which is ultimately responsible for * transforming classes loaded from controlled packages. The default delegate * does nothing. */ public PlasticManagerBuilder delegate(PlasticManagerDelegate delegate) { assert delegate != null; check(); this.delegate = delegate; return this; }
/** Creates a new builder using the specified class loader. */ public static PlasticManagerBuilder withClassLoader(ClassLoader loader) { return new PlasticManagerBuilder(loader); }
public PlasticManagerBuilder enable(TransformationOption option) { check(); options.add(option); return this; }
/** * Adds additional controlled packages, in which classes are loaded and transformed. */ public PlasticManagerBuilder packages(Collection<String> packageNames) { check(); packages.addAll(packageNames); return this; }