org.apache.tiles.core.factory

## Class BasicTilesContainerFactory

- java.lang.Object
- - org.apache.tiles.core.factory.AbstractTilesContainerFactory
  - - org.apache.tiles.core.factory.BasicTilesContainerFactory

- Direct Known Subclasses:
    StrutsTilesContainerFactory

      public class BasicTilesContainerFactory
      extends AbstractTilesContainerFactory

  Factory that builds a standard Tiles container using only Java code.
  Since:
    2.1.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `DEFINITION_RENDERER_NAME` The definition renderer name.
    `protected static String` | `STRING_RENDERER_NAME` The string renderer name.
    `protected static String` | `TEMPLATE_RENDERER_NAME` The template renderer name.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicTilesContainerFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected AttributeEvaluatorFactory` | `createAttributeEvaluatorFactory(ApplicationContext applicationContext, LocaleResolver resolver)` Creates the attribute evaluator factory to use.
    `TilesContainer` | `createContainer(ApplicationContext applicationContext)` Creates a Tiles container.
    `protected TilesContainer` | `createDecoratedContainer(TilesContainer originalContainer, ApplicationContext context)` Instantiate the container that will be injected to child objects.
    `protected Renderer` | `createDefaultAttributeRenderer(BasicRendererFactory rendererFactory, ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Creates the default attribute renderer.
    `protected Renderer` | `createDefinitionAttributeRenderer(BasicRendererFactory rendererFactory, ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Creates a `Renderer` using a `DefinitionRenderer`.
    `protected DefinitionsFactory` | `createDefinitionsFactory(ApplicationContext applicationContext, LocaleResolver resolver)` Creates the definitions factory.
    `protected DefinitionsReader` | `createDefinitionsReader(ApplicationContext applicationContext)` Creates the definitions reader.
    `protected DefinitionDAO<Locale>` | `createLocaleDefinitionDao(ApplicationContext applicationContext, LocaleResolver resolver)` Creates a Locale-based definition DAO.
    `protected LocaleResolver` | `createLocaleResolver(ApplicationContext applicationContext)` Creates the locale resolver.
    `protected <T> PatternDefinitionResolver<T>` | `createPatternDefinitionResolver(Class<T> customizationKeyClass)` Creates a new pattern definition resolver.
    `protected PreparerFactory` | `createPreparerFactory(ApplicationContext applicationContext)` Creates the preparer factory to use.
    `protected RendererFactory` | `createRendererFactory(ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Creates a renderer factory.
    `protected Renderer` | `createStringAttributeRenderer(BasicRendererFactory rendererFactory, ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Creates an attribute renderer to render strings.
    `protected Renderer` | `createTemplateAttributeRenderer(BasicRendererFactory rendererFactory, ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Creates a `Renderer` that uses a `DispatchRenderer`.
    `protected List<ApplicationResource>` | `getSources(ApplicationContext applicationContext)` Returns a list containing the resources to be parsed.
    `protected BasicTilesContainer` | `instantiateContainer(ApplicationContext context)` Instantiate the container, without initialization.
    `protected UnresolvingLocaleDefinitionsFactory` | `instantiateDefinitionsFactory(ApplicationContext applicationContext, LocaleResolver resolver)` Instantiate a new definitions factory based on Locale.
    `protected BaseLocaleUrlDefinitionDAO` | `instantiateLocaleDefinitionDao(ApplicationContext applicationContext, LocaleResolver resolver)` Instantiate (and does not initialize) a Locale-based definition DAO.
    `protected void` | `registerAttributeRenderers(BasicRendererFactory rendererFactory, ApplicationContext applicationContext, TilesContainer container, AttributeEvaluatorFactory attributeEvaluatorFactory)` Registers attribute renderers in a `BasicRendererFactory`.

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

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

- - ### Field Detail

    - #### STRING_RENDERER_NAME

          protected static final String STRING_RENDERER_NAME

      The string renderer name.
      See Also:
        Constant Field Values

    - #### TEMPLATE_RENDERER_NAME

          protected static final String TEMPLATE_RENDERER_NAME

      The template renderer name.
      See Also:
        Constant Field Values

    - #### DEFINITION_RENDERER_NAME

          protected static final String DEFINITION_RENDERER_NAME

      The definition renderer name.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BasicTilesContainerFactory

          public BasicTilesContainerFactory()

  - ### Method Detail

    - #### createContainer

          public TilesContainer createContainer(ApplicationContext applicationContext)

      Creates a Tiles container.
      Specified by:
        `createContainer` in class `AbstractTilesContainerFactory`
      Parameters:
        `applicationContext` - The Tiles application context object.
      Returns:
        The created container.

    - #### instantiateContainer

          protected BasicTilesContainer instantiateContainer(ApplicationContext context)

      Instantiate the container, without initialization.
      Parameters:
        `context` - The Tiles application context object.
      Returns:
        The instantiated container.
      Since:
        2.1.1

    - #### createDecoratedContainer

          protected TilesContainer createDecoratedContainer(TilesContainer originalContainer,
                                                            ApplicationContext context)

      Instantiate the container that will be injected to child objects.
      Parameters:
        `originalContainer` - The original instantiated container.
        `context` - The Tiles application context object.
      Returns:
        The instantiated container.
      Since:
        3.0.0

    - #### createDefinitionsFactory

          protected DefinitionsFactory createDefinitionsFactory(ApplicationContext applicationContext,
                                                                LocaleResolver resolver)

      Creates the definitions factory. By default it creates a `UnresolvingLocaleDefinitionsFactory` with default dependencies.
      Parameters:
        `applicationContext` - The Tiles application context.
        `resolver` - The locale resolver.
      Returns:
        The definitions factory.
      Since:
        2.1.1

    - #### instantiateDefinitionsFactory

          protected UnresolvingLocaleDefinitionsFactory instantiateDefinitionsFactory(ApplicationContext applicationContext,
                                                                                      LocaleResolver resolver)

      Instantiate a new definitions factory based on Locale.
      Parameters:
        `applicationContext` - The Tiles application context.
        `resolver` - The locale resolver.
      Returns:
        The definitions factory.
      Since:
        2.2.1

    - #### instantiateLocaleDefinitionDao

          protected BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(ApplicationContext applicationContext,
                                                                              LocaleResolver resolver)

      Instantiate (and does not initialize) a Locale-based definition DAO.
      Parameters:
        `applicationContext` - The Tiles application context.
        `resolver` - The locale resolver.
      Returns:
        The definition DAO.
      Since:
        2.1.1

    - #### createLocaleDefinitionDao

          protected DefinitionDAO<Locale> createLocaleDefinitionDao(ApplicationContext applicationContext,
                                                                    LocaleResolver resolver)

      Creates a Locale-based definition DAO.
      Parameters:
        `applicationContext` - The Tiles application context.
        `resolver` - The locale resolver.
      Returns:
        The definition DAO.
      Since:
        2.1.1

    - #### createLocaleResolver

          protected LocaleResolver createLocaleResolver(ApplicationContext applicationContext)

      Creates the locale resolver. By default it creates a `DefaultLocaleResolver`.
      Parameters:
        `applicationContext` - The Tiles application context.
      Returns:
        The locale resolver.
      Since:
        2.1.1

    - #### createDefinitionsReader

          protected DefinitionsReader createDefinitionsReader(ApplicationContext applicationContext)

      Creates the definitions reader. By default it creates a `DigesterDefinitionsReader`.
      Parameters:
        `applicationContext` - The Tiles application context.
      Returns:
        The definitions reader.
      Since:
        2.1.1

    - #### getSources

          protected List<ApplicationResource> getSources(ApplicationContext applicationContext)

      Returns a list containing the resources to be parsed. By default, it returns a list containing the resource at "/WEB-INF/tiles.xml".
      Parameters:
        `applicationContext` - The Tiles application context.
      Returns:
        The resources.
      Since:
        2.1.1

    - #### createAttributeEvaluatorFactory

          protected AttributeEvaluatorFactory createAttributeEvaluatorFactory(ApplicationContext applicationContext,
                                                                              LocaleResolver resolver)

      Creates the attribute evaluator factory to use. By default it returns a `BasicAttributeEvaluatorFactory` containing the `DirectAttributeEvaluator` as the default evaluator.
      Parameters:
        `applicationContext` - The Tiles application context.
        `resolver` - The locale resolver.
      Returns:
        The evaluator factory.
      Since:
        2.2.0

    - #### createPreparerFactory

          protected PreparerFactory createPreparerFactory(ApplicationContext applicationContext)

      Creates the preparer factory to use. By default it returns a `BasicPreparerFactory`.
      Parameters:
        `applicationContext` - The Tiles application context.
      Returns:
        The preparer factory.
      Since:
        2.1.1

    - #### createRendererFactory

          protected RendererFactory createRendererFactory(ApplicationContext applicationContext,
                                                          TilesContainer container,
                                                          AttributeEvaluatorFactory attributeEvaluatorFactory)

      Creates a renderer factory. By default, it returns a `BasicRendererFactory`, composed of an `ChainedDelegateRenderer` as default, and delegates of `StringRenderer`, `DispatchRenderer`, `DefinitionRenderer`.
      Parameters:
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Returns:
        The renderer factory.
      Since:
        2.2.0

    - #### createDefaultAttributeRenderer

          protected Renderer createDefaultAttributeRenderer(BasicRendererFactory rendererFactory,
                                                            ApplicationContext applicationContext,
                                                            TilesContainer container,
                                                            AttributeEvaluatorFactory attributeEvaluatorFactory)

      Creates the default attribute renderer. By default it is an `ChainedDelegateRenderer`.
      Parameters:
        `rendererFactory` - The renderer factory to configure.
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Returns:
        The default attribute renderer.
      Since:
        3.0.0

    - #### createPatternDefinitionResolver

          protected <T> PatternDefinitionResolver<T> createPatternDefinitionResolver(Class<T> customizationKeyClass)

      Creates a new pattern definition resolver. By default, it instantiate a `BasicPatternDefinitionResolver` with `WildcardDefinitionPatternMatcherFactory` to manage wildcard substitution.
      Type Parameters:
        `T` - The type of the customization key.
      Parameters:
        `customizationKeyClass` - The customization key class.
      Returns:
        The pattern definition resolver.
      Since:
        2.2.0

    - #### registerAttributeRenderers

          protected void registerAttributeRenderers(BasicRendererFactory rendererFactory,
                                                    ApplicationContext applicationContext,
                                                    TilesContainer container,
                                                    AttributeEvaluatorFactory attributeEvaluatorFactory)

      Registers attribute renderers in a `BasicRendererFactory`. By default, it registers delegates to `StringRenderer`, `DispatchRenderer` and `DefinitionRenderer`.
      Parameters:
        `rendererFactory` - The renderer factory to configure.
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Since:
        2.2.0

    - #### createStringAttributeRenderer

          protected Renderer createStringAttributeRenderer(BasicRendererFactory rendererFactory,
                                                           ApplicationContext applicationContext,
                                                           TilesContainer container,
                                                           AttributeEvaluatorFactory attributeEvaluatorFactory)

      Creates an attribute renderer to render strings.
      Parameters:
        `rendererFactory` - The renderer factory to configure.
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Returns:
        The renderer.
      Since:
        3.0.0

    - #### createTemplateAttributeRenderer

          protected Renderer createTemplateAttributeRenderer(BasicRendererFactory rendererFactory,
                                                             ApplicationContext applicationContext,
                                                             TilesContainer container,
                                                             AttributeEvaluatorFactory attributeEvaluatorFactory)

      Creates a `Renderer` that uses a `DispatchRenderer`.
      Parameters:
        `rendererFactory` - The renderer factory to configure.
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Returns:
        The renderer.
      Since:
        2.2.1

    - #### createDefinitionAttributeRenderer

          protected Renderer createDefinitionAttributeRenderer(BasicRendererFactory rendererFactory,
                                                               ApplicationContext applicationContext,
                                                               TilesContainer container,
                                                               AttributeEvaluatorFactory attributeEvaluatorFactory)

      Creates a `Renderer` using a `DefinitionRenderer`.
      Parameters:
        `rendererFactory` - The renderer factory to configure.
        `applicationContext` - The Tiles application context.
        `container` - The container.
        `attributeEvaluatorFactory` - The attribute evaluator factory.
      Returns:
        The renderer.
      Since:
        3.0.0

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.