Package org.apache.velocity.tools.config
Class ToolConfiguration
- java.lang.Object
-
- org.apache.velocity.tools.config.Configuration
-
- org.apache.velocity.tools.config.ToolConfiguration
-
- All Implemented Interfaces:
Comparable<Configuration>
public class ToolConfiguration extends Configuration
This class handles configuration info for tools, including their key, classname, path restriction, and properties. It also does fairly aggresive validation and is able to identify if the tool is "old" (i.e. designed for VelocityTools 1.x). Once configuration is complete, a
ToolInfoinstance can be created by callingcreateInfo().Most users will not find themselves directly using the API of this class.
- Version:
- $Id: ToolConfiguration.java 511959 2007-02-26 19:24:39Z nbubna $
- Author:
- Nathan Bubna
-
-
Constructor Summary
Constructors Constructor Description ToolConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConfiguration(Configuration config)intcompareTo(Configuration conf)ToolInfocreateInfo()booleanequals(Object obj)StringgetClassname()StringgetDefaultKey()Returns the default key value for the set tool class.String[]getInvalidScopes()StringgetKey()Returns the key set for this tool.StringgetRestrictTo()BooleangetSkipSetters()ClassgetToolClass()String[]getValidScopes()inthashCode()voidsetClass(Class clazz)voidsetClassname(String classname)voidsetKey(String key)voidsetRestrictTo(String path)voidsetSkipSetters(Boolean cfgOnly)StringtoString()voidvalidate()-
Methods inherited from class org.apache.velocity.tools.config.Configuration
addProperty, appendProperties, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
-
-
-
-
Method Detail
-
setKey
public void setKey(String key)
-
setClass
public void setClass(Class clazz)
-
setClassname
public void setClassname(String classname)
-
setRestrictTo
public void setRestrictTo(String path)
-
setSkipSetters
public void setSkipSetters(Boolean cfgOnly)
-
getKey
public String getKey()
Returns the key set for this tool. If no key has been explicitly set, this will return the result ofgetDefaultKey().
-
getDefaultKey
public String getDefaultKey()
Returns the default key value for the set tool class. First, this looks for aDefaultKeyannotation on the tool class. Then, if there is no default key annotation, theClass.getSimpleName()is transformed into the key by removing any 'Tool' suffix and lowercasing the first character. This will only returnnullif there is both no key and no classname set for this tool.
-
getClassname
public String getClassname()
-
getToolClass
public Class getToolClass()
-
getInvalidScopes
public String[] getInvalidScopes()
-
getValidScopes
public String[] getValidScopes()
-
getRestrictTo
public String getRestrictTo()
-
getSkipSetters
public Boolean getSkipSetters()
-
createInfo
public ToolInfo createInfo()
-
addConfiguration
public void addConfiguration(Configuration config)
- Overrides:
addConfigurationin classConfiguration
-
validate
public void validate()
- Overrides:
validatein classConfiguration
-
compareTo
public int compareTo(Configuration conf)
- Specified by:
compareToin interfaceComparable<Configuration>- Overrides:
compareToin classConfiguration
-
hashCode
public int hashCode()
- Overrides:
hashCodein classConfiguration
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classConfiguration
-
-