org.apache.tapestry5.internal.services

## Class ComponentInstantiatorSourceImpl

- java.lang.Object
- - org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl

- All Implemented Interfaces:
    Runnable, ComponentInstantiatorSource, PlasticClassListener, PlasticClassTransformer, PlasticManagerDelegate, UpdateListener

      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

    Constructors
    Constructor and Description
    `ComponentInstantiatorSourceImpl(org.slf4j.Logger logger, LoggerSource loggerSource, PlasticProxyFactory proxyFactory, ComponentClassTransformWorker2 transformerChain, ClasspathURLConverter classpathURLConverter, OperationTracker tracker, Map<String,ControlledPackageType> configuration, boolean productionMode, ComponentClassResolver resolver, InternalComponentInvalidationEventHub invalidationHub)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkForUpdates()` 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` | `exists(String className)` Checks to see if a fully qualified class name exists.
    `void` | `forceComponentInvalidation()` Forces invalidation logic, as if a component class on the disk had changed, forcing a reload of all pages and components.
    `Instantiator` | `getInstantiator(String className)` Given the name of a component class, provides an instantiator for that component.
    `PlasticProxyFactory` | `getProxyFactory()` Returns a proxy factory that can be used to generate additional classes around enhanced classes, or create subclasses of enhanced classes.
    `void` | `listenForUpdates(UpdateListenerHub hub)`
    `void` | `run()`
    `void` | `transform(PlasticClass plasticClass)` Perform whatever transformations are appropriate on this PlasticClass.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ComponentInstantiatorSourceImpl

          public ComponentInstantiatorSourceImpl(org.slf4j.Logger logger,
                                                 LoggerSource loggerSource,
                                                 @Builtin
                                                 PlasticProxyFactory proxyFactory,
                                                 @Primary
                                                 ComponentClassTransformWorker2 transformerChain,
                                                 ClasspathURLConverter classpathURLConverter,
                                                 OperationTracker tracker,
                                                 Map<String,ControlledPackageType> configuration,
                                                 @Symbol(value="tapestry.production-mode")
                                                 boolean productionMode,
                                                 ComponentClassResolver resolver,
                                                 InternalComponentInvalidationEventHub invalidationHub)

  - ### Method Detail

    - #### listenForUpdates

          @PostInjection
          public void listenForUpdates(UpdateListenerHub hub)

    - #### checkForUpdates

          public void 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 interface `UpdateListener`

    - #### forceComponentInvalidation

          public void 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 interface `ComponentInstantiatorSource`

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### getInstantiator

          public Instantiator getInstantiator(String className)

      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 interface `ComponentInstantiatorSource`
      Parameters:
        `className` - FQCN to find (and perhaps transform and load)
      Returns:
        an object which can instantiate an instance of the component

    - #### exists

          public boolean exists(String className)

      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 interface `ComponentInstantiatorSource`
      Parameters:
        `className` - name of class to check
      Returns:
        true if the class exists (there's a ".class" file), false otherwise

    - #### getProxyFactory

          public PlasticProxyFactory 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 interface `ComponentInstantiatorSource`

    - #### transform

          public void transform(PlasticClass plasticClass)

      Description copied from interface: `PlasticClassTransformer`
      Perform whatever transformations are appropriate on this PlasticClass.
      Specified by:
        `transform` in interface `PlasticClassTransformer`

    - #### 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 interface `PlasticManagerDelegate`
      Parameters:
        `className` - fully qualified class name that was transformed
        `instantiator` - default instantiator, which has an empty `InstanceContext`
      Returns:
        the same instantiator, or a new one configured with additional `InstanceContext` values

    - #### classWillLoad

          public void classWillLoad(PlasticClassEvent event)

      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 interface `PlasticClassListener`
      Parameters:
        `event` - describes the class to be loaded, and gives access to its disassembled bytecode (for debugging purposes)

5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.