Class ToolConfiguration
java.lang.Object
org.apache.velocity.tools.config.Configuration
org.apache.velocity.tools.config.ToolConfiguration
- All Implemented Interfaces:
Comparable<Configuration>
This class handles configuration info for tools, including their key,
classname, path restriction, and properties. It also does fairly
aggresive validation.
Once configuration is complete, a ToolInfo instance can be created by calling
createInfo().
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(Configuration config) intcompareTo(Configuration conf) booleanReturns the default key value for the set tool class.String[]getKey()Returns the key set for this tool.String[]inthashCode()voidDeprecated.voidvoidsetClassname(String classname) voidsetFactory(Class factory) voidsetFactoryClassname(String factoryClassname) voidvoidsetRestrictTo(String path) voidsetSkipSetters(Boolean cfgOnly) toString()voidvalidate()Methods inherited from class Configuration
addProperty, appendProperties, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
-
Constructor Details
-
ToolConfiguration
public ToolConfiguration()
-
-
Method Details
-
setKey
-
setClass
Deprecated.This method should be avoided, since considered unsafe by the security manager.- Parameters:
clazz- the Class- See Also:
-
setClass
-
setClassname
-
setFactory
-
setFactoryClassname
-
setRestrictTo
-
setSkipSetters
-
getKey
Returns the key set for this tool. If no key has been explicitly set, this will return the result ofgetDefaultKey().- Returns:
- tool key
-
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.- Returns:
- default tool key
-
getClassname
-
getFactoryClassname
-
getToolClass
-
getFactory
-
getInvalidScopes
-
getValidScopes
-
getRestrictTo
-
getSkipSetters
-
createInfo
-
addConfiguration
- Overrides:
addConfigurationin classConfiguration
-
validate
public void validate()- Overrides:
validatein classConfiguration
-
compareTo
- Specified by:
compareToin interfaceComparable<Configuration>- Overrides:
compareToin classConfiguration
-
hashCode
public int hashCode()- Overrides:
hashCodein classConfiguration
-
equals
- Overrides:
equalsin classConfiguration
-
toString
-