Class ProtectedFunctionMapper


  • public final class ProtectedFunctionMapper
    extends javax.el.FunctionMapper
    Maps EL functions to their Java method counterparts. Keeps the actual Method objects protected so that JSP pages can't indirectly do reflection.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<java.lang.String,​java.lang.reflect.Method> fnmap
      Maps "prefix:name" to java.lang.Method objects.
      private java.lang.reflect.Method theMethod
      If there is only one function in the map, this is the Method for it.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ProtectedFunctionMapper()
      Constructor has protected access.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ProtectedFunctionMapper getInstance()
      Generated Servlet and Tag Handler implementations call this method to retrieve an instance of the ProtectedFunctionMapper.
      static ProtectedFunctionMapper getMapForFunction​(java.lang.String fnQName, java.lang.Class<?> c, java.lang.String methodName, java.lang.Class<?>[] args)
      Creates an instance for this class, and stores the Method for the given EL function prefix and name.
      void mapFunction​(java.lang.String fnQName, java.lang.Class<?> c, java.lang.String methodName, java.lang.Class<?>[] args)
      Stores a mapping from the given EL function prefix and name to the given Java method.
      java.lang.reflect.Method resolveFunction​(java.lang.String prefix, java.lang.String localName)
      Resolves the specified local name and prefix into a Java.lang.Method.
      • Methods inherited from class javax.el.FunctionMapper

        mapFunction
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fnmap

        private java.util.HashMap<java.lang.String,​java.lang.reflect.Method> fnmap
        Maps "prefix:name" to java.lang.Method objects.
      • theMethod

        private java.lang.reflect.Method theMethod
        If there is only one function in the map, this is the Method for it.
    • Constructor Detail

      • ProtectedFunctionMapper

        private ProtectedFunctionMapper()
        Constructor has protected access.
    • Method Detail

      • getInstance

        public static ProtectedFunctionMapper getInstance()
        Generated Servlet and Tag Handler implementations call this method to retrieve an instance of the ProtectedFunctionMapper. This is necessary since generated code does not have access to create instances of classes in this package.
        Returns:
        A new protected function mapper.
      • mapFunction

        public void mapFunction​(java.lang.String fnQName,
                                java.lang.Class<?> c,
                                java.lang.String methodName,
                                java.lang.Class<?>[] args)
        Stores a mapping from the given EL function prefix and name to the given Java method.
        Parameters:
        fnQName - The EL function qualified name (including prefix)
        c - The class containing the Java method
        methodName - The name of the Java method
        args - The arguments of the Java method
        Throws:
        java.lang.RuntimeException - if no method with the given signature could be found.
      • getMapForFunction

        public static ProtectedFunctionMapper getMapForFunction​(java.lang.String fnQName,
                                                                java.lang.Class<?> c,
                                                                java.lang.String methodName,
                                                                java.lang.Class<?>[] args)
        Creates an instance for this class, and stores the Method for the given EL function prefix and name. This method is used for the case when there is only one function in the EL expression.
        Parameters:
        fnQName - The EL function qualified name (including prefix)
        c - The class containing the Java method
        methodName - The name of the Java method
        args - The arguments of the Java method
        Throws:
        java.lang.RuntimeException - if no method with the given signature could be found.
      • resolveFunction

        public java.lang.reflect.Method resolveFunction​(java.lang.String prefix,
                                                        java.lang.String localName)
        Resolves the specified local name and prefix into a Java.lang.Method. Returns null if the prefix and local name are not found.
        Specified by:
        resolveFunction in class javax.el.FunctionMapper
        Parameters:
        prefix - the prefix of the function
        localName - the short name of the function
        Returns:
        the result of the method mapping. Null means no entry found.