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>
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 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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfiguration
(Configuration config) int
compareTo
(Configuration conf) private void
digForDependencies
(Class clazz) boolean
Returns the default key value for the set tool class.private final String
getError
(ToolConfiguration.Status status) String[]
getKey()
Returns the key set for this tool.private final ToolConfiguration.Status
String[]
int
hashCode()
void
void
setClassname
(String classname) void
void
setRestrictTo
(String path) void
setSkipSetters
(Boolean cfgOnly) toString()
void
validate()
Methods inherited from class org.apache.velocity.tools.config.Configuration
addProperty, appendProperties, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
-
Field Details
-
key
-
classname
-
restrictTo
-
skipSetters
-
status
-
problem
-
-
Constructor Details
-
ToolConfiguration
public ToolConfiguration()
-
-
Method Details
-
setKey
-
setClass
-
setClassname
-
setRestrictTo
-
setSkipSetters
-
getKey
Returns the key set for this tool. If no key has been explicitly set, this will return the result ofgetDefaultKey()
. -
getDefaultKey
Returns the default key value for the set tool class. First, this looks for aDefaultKey
annotation 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 returnnull
if there is both no key and no classname set for this tool. -
getClassname
-
getToolClass
-
getInvalidScopes
-
getValidScopes
-
getStatus
-
digForDependencies
-
getRestrictTo
-
getSkipSetters
-
createInfo
-
getError
-
addConfiguration
- Overrides:
addConfiguration
in classConfiguration
-
validate
public void validate()- Overrides:
validate
in classConfiguration
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Configuration>
- Overrides:
compareTo
in classConfiguration
-
hashCode
public int hashCode()- Overrides:
hashCode
in classConfiguration
-
equals
- Overrides:
equals
in classConfiguration
-
toString
-