Class CascadeFieldTool


  • @Deprecated
    public class CascadeFieldTool
    extends org.apache.velocity.tools.generic.FieldTool
    Deprecated.

    Customization of FieldTool from the Apache Velocity Tools package. This particular implementation allows for exclusion of specified packages from FieldTool's scope, as well as specific classes which are exceptions to the specified exclusion list.

    Example:

    CascadeFieldTool tool = new CascadeFieldTool();
    tool.addExcludedPackage("com.hannonhill.cascade.model");
    tool.addExcludedPackage("com.hannonhill.cascade.view");

    Left as above, all classes belonging to com.hannonhill.cascade.model and com.hannonhill.cascade.view (or any sub-packages of the two) will be excluded from the scope of tool.

    If we wished to allow access to com.hannonhill.cascade.model.constants.SystemVersions via tool, we can simply add it as an exception:

    tool.addException("com.hannonhill.cascade.model.constants.SystemVersions");

    Note: Exceptions must be specified as fully-qualified class names, not packages. Excluded packages may actually be specified as package names OR fully-qualified class names.

    Since:
    7.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.velocity.tools.generic.FieldTool

        org.apache.velocity.tools.generic.FieldTool.FieldToolSub, org.apache.velocity.tools.generic.FieldTool.MutableField
    • Field Summary

      • Fields inherited from class org.apache.velocity.tools.generic.FieldTool

        INCLUDE_KEY, log, storage, STORE_DYNAMIC_KEY, storeDynamicLookups
      • Fields inherited from class org.apache.velocity.tools.generic.SafeConfig

        LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY
    • Constructor Summary

      Constructors 
      Constructor Description
      CascadeFieldTool()
      Deprecated.
      Constructs a CascadeFieldTool and initializes empty lists of excluded packages and explicit exceptions from exclusion.
      CascadeFieldTool​(java.util.List<java.lang.String> liExcluded, java.util.List<java.lang.String> liExceptions)
      Deprecated.
      Constructs a CascadeFieldTool instance with the specified list of packages excluded from scope, and the specified list of class exceptions from the package exclusion rules.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addException​(java.lang.String stClass)
      Deprecated.
      Adds a specific class name which is an exception to the package exclusion rules defined via addExcludedPackage(String) or addExcludedPackages(List).
      void addExceptions​(java.util.List<java.lang.String> liExceptions)
      Deprecated.
      Adds a list of specific class names which are an exception to the package exclusion rules defined via addExcludedPackage(String) or addExcludedPackages(List).
      void addExcludedPackage​(java.lang.String stPackage)
      Deprecated.
      Adds a package name to be excluded from the scope of this CascadeFieldTool instance.
      void addExcludedPackages​(java.util.List<java.lang.String> liPackages)
      Deprecated.
      Adds a list of package names to be excluded from the scope of this CascadeFieldTool instance.
      org.apache.velocity.tools.generic.FieldTool.FieldToolSub in​(java.lang.Object instance)
      Deprecated.
       
      org.apache.velocity.tools.generic.FieldTool.FieldToolSub in​(java.lang.String classname)
      Deprecated.
       
      protected java.util.Map<java.lang.String,​java.lang.Object> inspect​(java.lang.Class clazz)
      Deprecated.
      Overriding from superclass so that we can check lists of excluded packages and specific exception classes before returning the static field values.
      • Methods inherited from class org.apache.velocity.tools.generic.FieldTool

        configure, get, in, retrieve
      • Methods inherited from class org.apache.velocity.tools.generic.SafeConfig

        configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
      • Methods inherited from class java.lang.Object

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

      • CascadeFieldTool

        public CascadeFieldTool()
        Deprecated.
        Constructs a CascadeFieldTool and initializes empty lists of excluded packages and explicit exceptions from exclusion.
      • CascadeFieldTool

        public CascadeFieldTool​(java.util.List<java.lang.String> liExcluded,
                                java.util.List<java.lang.String> liExceptions)
        Deprecated.

        Constructs a CascadeFieldTool instance with the specified list of packages excluded from scope, and the specified list of class exceptions from the package exclusion rules.

        Example:

        List exclusions = Arrays.asList("com.mycompany.myproject.mypackage1","com.mycompany.myproject.mypackage2");
        List exceptions = Arrays.asList("com.mycompany.myproject.mypackage1.ClassToBeIncluded1","com.mycompany.myproject.mypackage1.ClassToBeInclude2");

        CascadeFieldTool tool = new CascadeFieldTool(exclusions,exceptions);

        In the above example, tool would not have access to any classes within com.mycompany.myproject.mypackage1 or com.mycompany.myproject.mypackage2 (or any sub-packages of the two), with the exception of ClassToBeIncluded1 and ClassToBeIncluded2 from the com.mycompany.myproject.mypackage1 package.

        Parameters:
        liExcluded -
        liExceptions -
    • Method Detail

      • addExcludedPackage

        public void addExcludedPackage​(java.lang.String stPackage)
        Deprecated.

        Adds a package name to be excluded from the scope of this CascadeFieldTool instance.

        Example:

        CascadeFieldTool tool = new CascadeFieldTool();
        tool.addExcludedPackage("com.myproject.mypackage");

        In the above example, anything within com.myproject.mypackage (or any sub-packages thereof) would be excluded from the scope of tool.

        Parameters:
        stPackage - a String package name to be excluded
      • addExcludedPackages

        public void addExcludedPackages​(java.util.List<java.lang.String> liPackages)
        Deprecated.

        Adds a list of package names to be excluded from the scope of this CascadeFieldTool instance.

        Example:

        CascadeFieldTool tool = new CascadeFieldTool();
        tool.addExcludedPackages(Arrays.asList("com.myproject.mypackage1","com.myproject.mypackage2"));

        In the above example, anything within com.myproject.mypackage1 and com.myproject.mypackage2 (or any sub-packages thereof) would be excluded from the scope of tool.

        Parameters:
        liPackages - a list of String package names to exclude.
      • addException

        public void addException​(java.lang.String stClass)
        Deprecated.

        Adds a specific class name which is an exception to the package exclusion rules defined via addExcludedPackage(String) or addExcludedPackages(List).

        Example:

        CascadeFieldTool tool = new CascadeFieldTool();
        tool.addExcludedPackage("com.myproject.mypackage");
        tool.addException("com.myproject.mypackage.ClassToBeIncluded");

        In the above example, anything within com.myproject.mypackage (or any sub-packages thereof) would be excluded from the scope of tool, with the exception of ClassToBeIncluded.

        Parameters:
        stClass -
      • addExceptions

        public void addExceptions​(java.util.List<java.lang.String> liExceptions)
        Deprecated.

        Adds a list of specific class names which are an exception to the package exclusion rules defined via addExcludedPackage(String) or addExcludedPackages(List).

        Example:

        CascadeFieldTool tool = new CascadeFieldTool();
        tool.addExcludedPackage("com.myproject.mypackage");
        tool.addExceptions(Arrays.asList("com.myproject.mypackage.ClassToBeIncluded1","com.myproject.mypackage.ClassToBeIncluded2"));

        In the above example, anything within com.myproject.mypackage (or any sub-packages thereof) would be excluded from the scope of tool, with the exception of ClassToBeIncluded1 and ClassToBeIncluded2.

        Parameters:
        liExceptions -
      • inspect

        protected java.util.Map<java.lang.String,​java.lang.Object> inspect​(java.lang.Class clazz)
        Deprecated.
        Overriding from superclass so that we can check lists of excluded packages and specific exception classes before returning the static field values.
        Overrides:
        inspect in class org.apache.velocity.tools.generic.FieldTool
        Parameters:
        clazz -
        Returns:
      • in

        public org.apache.velocity.tools.generic.FieldTool.FieldToolSub in​(java.lang.Object instance)
        Deprecated.
        Overrides:
        in in class org.apache.velocity.tools.generic.FieldTool
      • in

        public org.apache.velocity.tools.generic.FieldTool.FieldToolSub in​(java.lang.String classname)
        Deprecated.
        Overrides:
        in in class org.apache.velocity.tools.generic.FieldTool