Class ComponentInstantiatorSourceImpl
java.lang.Object
org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl
- All Implemented Interfaces:
Runnable
,ComponentInstantiatorSource
,UpdateListener
,PlasticClassListener
,PlasticClassTransformer
,PlasticManagerDelegate
public final class ComponentInstantiatorSourceImpl
extends Object
implements ComponentInstantiatorSource, UpdateListener, Runnable, PlasticManagerDelegate, PlasticClassListener
A wrapper around a
PlasticManager
that allows certain classes to be modified as they are loaded.-
Constructor Summary
ConstructorsConstructorDescriptionComponentInstantiatorSourceImpl
(org.slf4j.Logger logger, LoggerSource loggerSource, PlasticProxyFactory proxyFactory, ComponentClassTransformWorker2 transformerChain, ClasspathURLConverter classpathURLConverter, OperationTracker tracker, Map<String, ControlledPackageType> configuration, boolean productionMode, boolean multipleClassLoaders, ComponentClassResolver resolver, InternalComponentInvalidationEventHub invalidationHub, PageClassLoaderContextManager pageClassLoaderContextManager, ComponentDependencyRegistry componentDependencyRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked to force the receiver to check for updates to whatever underlying resources it makes use of.void
classWillLoad
(PlasticClassEvent event) Invoked just before a class is to be loaded.<T> ClassInstantiator<T>
configureInstantiator
(String className, ClassInstantiator<T> instantiator) Configures the instantiator for a transformed PlasticClass.boolean
Checks to see if a fully qualified class name exists.void
Forces invalidation logic, as if a component class on the disk had changed, forcing a reload of all pages and components.getInstantiator
(String className) Given the name of a component class, provides an instantiator for that component.Returns a proxy factory that can be used to generate additional classes around enhanced classes, or create subclasses of enhanced classes.void
void
run()
void
transform
(PlasticClass plasticClass) Perform whatever transformations are appropriate on this PlasticClass.
-
Constructor Details
-
ComponentInstantiatorSourceImpl
public ComponentInstantiatorSourceImpl(org.slf4j.Logger logger, LoggerSource loggerSource, @Builtin PlasticProxyFactory proxyFactory, @Primary ComponentClassTransformWorker2 transformerChain, ClasspathURLConverter classpathURLConverter, OperationTracker tracker, Map<String, ControlledPackageType> configuration, @Symbol("tapestry.production-mode") boolean productionMode, @Symbol("tapestry.multiple-classloaders") boolean multipleClassLoaders, ComponentClassResolver resolver, InternalComponentInvalidationEventHub invalidationHub, PageClassLoaderContextManager pageClassLoaderContextManager, ComponentDependencyRegistry componentDependencyRegistry)
-
-
Method Details
-
listenForUpdates
-
checkForUpdates
Description copied from interface:UpdateListener
Invoked to force the receiver to check for updates to whatever underlying resources it makes use of.- Specified by:
checkForUpdates
in interfaceUpdateListener
-
forceComponentInvalidation
Description copied from interface:ComponentInstantiatorSource
Forces invalidation logic, as if a component class on the disk had changed, forcing a reload of all pages and components.- Specified by:
forceComponentInvalidation
in interfaceComponentInstantiatorSource
-
run
-
getInstantiator
Description copied from interface:ComponentInstantiatorSource
Given the name of a component class, provides an instantiator for that component. Instantiators are cached, so repeated calls to this method with the same class name will return the same instance; however, callers should also be aware that the instantiators may lose validity after an invalidation (caused by changes to external Java class files).- Specified by:
getInstantiator
in interfaceComponentInstantiatorSource
- Parameters:
className
- FQCN to find (and perhaps transform and load)- Returns:
- an object which can instantiate an instance of the component
-
exists
Description copied from interface:ComponentInstantiatorSource
Checks to see if a fully qualified class name exists. This method appears to exist only for testing.- Specified by:
exists
in interfaceComponentInstantiatorSource
- Parameters:
className
- name of class to check- Returns:
- true if the class exists (there's a ".class" file), false otherwise
-
getProxyFactory
Description copied from interface:ComponentInstantiatorSource
Returns a proxy factory that can be used to generate additional classes around enhanced classes, or create subclasses of enhanced classes.- Specified by:
getProxyFactory
in interfaceComponentInstantiatorSource
-
transform
Description copied from interface:PlasticClassTransformer
Perform whatever transformations are appropriate on this PlasticClass.- Specified by:
transform
in interfacePlasticClassTransformer
-
configureInstantiator
public <T> ClassInstantiator<T> configureInstantiator(String className, ClassInstantiator<T> instantiator) Description copied from interface:PlasticManagerDelegate
Configures the instantiator for a transformed PlasticClass.- Specified by:
configureInstantiator
in interfacePlasticManagerDelegate
- Parameters:
className
- fully qualified class name that was transformedinstantiator
- default instantiator, which has an emptyInstanceContext
- Returns:
- the same instantiator, or a new one configured with additional
InstanceContext
values
-
classWillLoad
Description copied from interface:PlasticClassListener
Invoked just before a class is to be loaded. Separate events are fired for supporting classes before the event for the primary class (the class being transformed or created from scratch).- Specified by:
classWillLoad
in interfacePlasticClassListener
- Parameters:
event
- describes the class to be loaded, and gives access to its disassembled bytecode (for debugging purposes)
-