Class CascadeFieldTool
- java.lang.Object
-
- org.apache.velocity.tools.generic.SafeConfig
-
- org.apache.velocity.tools.generic.FieldTool
-
- com.hannonhill.cascade.velocity.CascadeFieldTool
-
@Deprecated public class CascadeFieldTool extends org.apache.velocity.tools.generic.FieldToolDeprecated.Customization of
FieldToolfrom 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.modelandcom.hannonhill.cascade.view(or any sub-packages of the two) will be excluded from the scope oftool.If we wished to allow access to
com.hannonhill.cascade.model.constants.SystemVersionsviatool, 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
-
-
Constructor Summary
Constructors Constructor Description CascadeFieldTool()Deprecated.Constructs aCascadeFieldTooland 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 voidaddException(java.lang.String stClass)Deprecated.Adds a specific class name which is an exception to the package exclusion rules defined viaaddExcludedPackage(String)oraddExcludedPackages(List).voidaddExceptions(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 viaaddExcludedPackage(String)oraddExcludedPackages(List).voidaddExcludedPackage(java.lang.String stPackage)Deprecated.Adds a package name to be excluded from the scope of this CascadeFieldTool instance.voidaddExcludedPackages(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.FieldToolSubin(java.lang.Object instance)Deprecated.org.apache.velocity.tools.generic.FieldTool.FieldToolSubin(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
-
-
-
-
Constructor Detail
-
CascadeFieldTool
public CascadeFieldTool()
Deprecated.Constructs aCascadeFieldTooland 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:
Listexclusions = Arrays.asList("com.mycompany.myproject.mypackage1","com.mycompany.myproject.mypackage2");
Listexceptions = Arrays.asList("com.mycompany.myproject.mypackage1.ClassToBeIncluded1","com.mycompany.myproject.mypackage1.ClassToBeInclude2");
CascadeFieldTool tool = new CascadeFieldTool(exclusions,exceptions);In the above example,
toolwould not have access to any classes withincom.mycompany.myproject.mypackage1orcom.mycompany.myproject.mypackage2(or any sub-packages of the two), with the exception ofClassToBeIncluded1andClassToBeIncluded2from thecom.mycompany.myproject.mypackage1package.- 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 oftool.- 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.mypackage1andcom.myproject.mypackage2(or any sub-packages thereof) would be excluded from the scope oftool.- 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)oraddExcludedPackages(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 oftool, with the exception ofClassToBeIncluded.- 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)oraddExcludedPackages(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 oftool, with the exception ofClassToBeIncluded1andClassToBeIncluded2.- 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:
inspectin classorg.apache.velocity.tools.generic.FieldTool- Parameters:
clazz-- Returns:
-
in
public org.apache.velocity.tools.generic.FieldTool.FieldToolSub in(java.lang.Object instance)
Deprecated.- Overrides:
inin classorg.apache.velocity.tools.generic.FieldTool
-
in
public org.apache.velocity.tools.generic.FieldTool.FieldToolSub in(java.lang.String classname)
Deprecated.- Overrides:
inin classorg.apache.velocity.tools.generic.FieldTool
-
-