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:
- java.lang.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 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
Methods inherited from class org.apache.velocity.tools.config.Configuration |
addProperty, appendProperties, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
key
private java.lang.String key
classname
private java.lang.String classname
restrictTo
private java.lang.String restrictTo
skipSetters
private java.lang.Boolean skipSetters
status
private ToolConfiguration.Status status
problem
private java.lang.Throwable problem
ToolConfiguration
public ToolConfiguration()
setKey
public void setKey(java.lang.String key)
setClass
public void setClass(java.lang.Class clazz)
setClassname
public void setClassname(java.lang.String classname)
setRestrictTo
public void setRestrictTo(java.lang.String path)
setSkipSetters
public void setSkipSetters(java.lang.Boolean cfgOnly)
getKey
public java.lang.String getKey()
- Returns the key set for this tool. If no key has been explicitly
set, this will return the result of
getDefaultKey()
.
getDefaultKey
public java.lang.String getDefaultKey()
- Returns the default key value for the set tool class. First, this
looks for a
DefaultKey
annotation on the tool class. Then,
if there is no default key annotation, the Class.getSimpleName()
is transformed into the key by removing any 'Tool' suffix and
lowercasing the first character. This will only return null
if there is both no key and no classname set for this tool.
getClassname
public java.lang.String getClassname()
getToolClass
public java.lang.Class getToolClass()
getInvalidScopes
public java.lang.String[] getInvalidScopes()
getValidScopes
public java.lang.String[] getValidScopes()
getStatus
private final ToolConfiguration.Status getStatus()
digForDependencies
private void digForDependencies(java.lang.Class clazz)
getRestrictTo
public java.lang.String getRestrictTo()
getSkipSetters
public java.lang.Boolean getSkipSetters()
createInfo
public ToolInfo createInfo()
getError
private final java.lang.String getError(ToolConfiguration.Status status)
addConfiguration
public void addConfiguration(Configuration config)
- Overrides:
addConfiguration
in class Configuration
validate
public void validate()
- Overrides:
validate
in class Configuration
compareTo
public int compareTo(Configuration conf)
- Specified by:
compareTo
in interface java.lang.Comparable<Configuration>
- Overrides:
compareTo
in class Configuration
hashCode
public int hashCode()
- Overrides:
hashCode
in class Configuration
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class Configuration
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright (c) 2003-2007 Apache Software Foundation