Package org.zkoss.xel.util

## Class TaglibMapper

- java.lang.Object
- - org.zkoss.xel.util.TaglibMapper

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`, `FunctionMapper`, `FunctionMapperExt`
  Direct Known Subclasses:
    `SimpleMapper`

      public class TaglibMapper
      extends java.lang.Object
      implements FunctionMapper, FunctionMapperExt, java.lang.Cloneable, java.io.Serializable

  A function mapper that is capable to load function and class definitions from taglib.
  Since:
    3.0.0, Taglib, Taglibs
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.Map<java.lang.String,​java.lang.Class>` | `_clses` | Map(String name, Class cls).
    `protected java.util.Map<java.lang.String,​Function>` | `_mtds` | Map(String prefix+":"+name, Function func).

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TaglibMapper()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addClass​(java.lang.String name, java.lang.Class cls)` | Adds the class that can be retrieved by `resolveClass(java.lang.String)`.
    `void` | `addFunction​(java.lang.String prefix, java.lang.String name, Function func)` | Adds the function that can be retrieved by `resolveFunction(java.lang.String, java.lang.String)`.
    `java.lang.Object` | `clone()` |
    `boolean` | `equals​(java.lang.Object o)` |
    `java.util.Collection<java.lang.String>` | `getClassNames()` | Returns a readonly collection of the logic names of the class (never null).
    `int` | `hashCode()` |
    `void` | `load​(java.lang.String prefix, java.lang.String uri, Locator locator)` | Loads function and class definitions from taglib.
    `void` | `load​(java.lang.String prefix, java.net.URL url)` | Loads function and class definitions from taglib.
    `void` | `load​(java.lang.String prefix, Element root)` | Loads function and class definitions from DOM.
    `void` | `load​(Taglib taglib, Locator locator)` | Loads function and class definitions from taglib.
    `java.lang.Class` | `resolveClass​(java.lang.String name)` | Resolves a class with the specified logic name, or null if not found.
    `Function` | `resolveFunction​(java.lang.String prefix, java.lang.String name)` | Resolves a function `Function` with the specified name and prefix.

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

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _mtds

          protected java.util.Map<java.lang.String,​Function> _mtds

      Map(String prefix+":"+name, Function func).

    - #### _clses

          protected java.util.Map<java.lang.String,​java.lang.Class> _clses

      Map(String name, Class cls).

  - ### Constructor Detail

    - #### TaglibMapper

          public TaglibMapper()

  - ### Method Detail

    - #### addClass

          public void addClass​(java.lang.String name,
                               java.lang.Class cls)

      Adds the class that can be retrieved by `resolveClass(java.lang.String)`.
      Parameters:
        `name` - the logic name of the class
        `cls` - the class to import

    - #### addFunction

          public void addFunction​(java.lang.String prefix,
                                  java.lang.String name,
                                  Function func)

      Adds the function that can be retrieved by `resolveFunction(java.lang.String, java.lang.String)`.
      Parameters:
        `prefix` - the prefix of the name
        `name` - the logic name of the function
        `func` - the function

    - #### load

          public void load​(java.lang.String prefix,
                           java.net.URL url)
                    throws XelException

      Loads function and class definitions from taglib.
      Throws:
        `XelException`

    - #### load

          public void load​(Taglib taglib,
                           Locator locator)

      Loads function and class definitions from taglib.

    - #### load

          public void load​(java.lang.String prefix,
                           java.lang.String uri,
                           Locator locator)
                    throws XelException

      Loads function and class definitions from taglib.
      Throws:
        `XelException`

    - #### load

          public void load​(java.lang.String prefix,
                           Element root)
                    throws XelException

      Loads function and class definitions from DOM.
      Throws:
        `XelException`

    - #### resolveFunction

          public Function resolveFunction​(java.lang.String prefix,
                                          java.lang.String name)

      Description copied from interface: `FunctionMapper`
      Resolves a function `Function` with the specified name and prefix.

      Note: not all EL evaluator support `FunctionMapper.resolveFunction(java.lang.String, java.lang.String)`. Currently only JSP 2.0/2.1 EL-based expression factories support this method. You can check `ExpressionFactory.isSupported(int)` for this support.

      Specified by:
        `resolveFunction` in interface `FunctionMapper`
      Parameters:
        `prefix` - the prefix of the function, or "" if no prefix
        `name` - the name of the function to resolve

    - #### getClassNames

          public java.util.Collection<java.lang.String> getClassNames()

      Description copied from interface: `FunctionMapperExt`
      Returns a readonly collection of the logic names of the class (never null). Note: it is the name to resolve class, not the real class name. In other words, it is the logical name maintained by this function mapper.
      Specified by:
        `getClassNames` in interface `FunctionMapperExt`

    - #### resolveClass

          public java.lang.Class resolveClass​(java.lang.String name)

      Description copied from interface: `FunctionMapperExt`
      Resolves a class with the specified logic name, or null if not found.

      Note: not all EL evaluator support `FunctionMapperExt.resolveClass(java.lang.String)`. JSP 2.0/2.1 EL-based expression factories don't support this method. You can check `ExpressionFactory.isSupported(int)` for this support.

      Specified by:
        `resolveClass` in interface `FunctionMapperExt`
      Returns:
        the class of the specified logic name.

    - #### clone

          public java.lang.Object clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`