org.apache.turbine.services.template.mapper

## Class ClassMapper

- java.lang.Object
- - org.apache.turbine.services.template.mapper.BaseMapper
  - - org.apache.turbine.services.template.mapper.ClassMapper

- All Implemented Interfaces:
    Mapper

      public class ClassMapper
      extends BaseMapper
      implements Mapper

  This mapper tries to map Template names to class names. If no direct match is found, it tries matches "upwards" in the package hierarchy until either a match is found or the root is hit. Then it returns the name of the default class from the TemplateEngineService. 1. about.directions.Driving <- direct matching the template to the class name 2. about.directions.Default <- matching the package, class name is Default 3. about.Default <- stepping up in the package hierarchy, looking for Default 4. Default <- Class called "Default" without package 5. VelocityScreen <- The class configured by the Service (VelocityService) to Please note, that no actual packages are searched. This is the scope of the TemplateEngine Loader which is passed at construction time.
  Version:
    $Id: ClassMapper.java 1709648 2015-10-20 17:08:10Z tv $
  Author:
    Henning P. Schmiedehausen

- - ### Field Summary

    - ### Fields inherited from class org.apache.turbine.services.template.mapper.BaseMapper

      `defaultProperty, separator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassMapper()` Default C'tor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `doMapping(String template)` Strip off a possible extension, replace all "," with "."
    `Loader<? extends Assembler>` | `getLoader()` Get the Loader value.
    `void` | `setLoader(Loader<? extends Assembler> loader)` Set the Loader value.

    - ### Methods inherited from class org.apache.turbine.services.template.mapper.BaseMapper

      `getCacheSize, getDefaultName, getDefaultProperty, getMappedName, getSeparator, init, isUseCache, setCacheSize, setDefaultProperty, setSeparator, setUseCache`

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

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

    - ### Methods inherited from interface org.apache.turbine.services.template.mapper.Mapper

      `getCacheSize, getDefaultName, getDefaultProperty, getMappedName, getSeparator, init, isUseCache, setCacheSize, setDefaultProperty, setSeparator, setUseCache`

- - ### Constructor Detail

    - #### ClassMapper

          public ClassMapper()

      Default C'tor. If you use this C'tor, you must use the bean setter to set the various properties needed for this mapper before first usage.

  - ### Method Detail

    - #### getLoader

          public Loader<? extends Assembler> getLoader()

      Get the Loader value.
      Returns:
        the Loader value.

    - #### setLoader

          public void setLoader(Loader<? extends Assembler> loader)

      Set the Loader value.
      Parameters:
        `loader` - The new Loader value.

    - #### doMapping

          public String doMapping(String template)

      Strip off a possible extension, replace all "," with "." Look through the given package path until a match is found.
      Specified by:
        `doMapping` in class `BaseMapper`
      Parameters:
        `template` - The template name.
      Returns:
        A class name for the given template.

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.