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.
Modifier and Type | Class and Description |
---|---|
private static class |
ToolConfiguration.Status |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
classname |
private java.lang.String |
key |
private java.lang.Throwable |
problem |
private java.lang.String |
restrictTo |
private java.lang.Boolean |
skipSetters |
private ToolConfiguration.Status |
status |
Constructor and Description |
---|
ToolConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguration(Configuration config) |
int |
compareTo(Configuration conf) |
ToolInfo |
createInfo() |
private void |
digForDependencies(java.lang.Class clazz) |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getClassname() |
java.lang.String |
getDefaultKey()
Returns the default key value for the set tool class.
|
private java.lang.String |
getError(ToolConfiguration.Status status) |
java.lang.String[] |
getInvalidScopes() |
java.lang.String |
getKey()
Returns the key set for this tool.
|
java.lang.String |
getRestrictTo() |
java.lang.Boolean |
getSkipSetters() |
private ToolConfiguration.Status |
getStatus() |
java.lang.Class |
getToolClass() |
java.lang.String[] |
getValidScopes() |
int |
hashCode() |
void |
setClass(java.lang.Class clazz) |
void |
setClassname(java.lang.String classname) |
void |
setKey(java.lang.String key) |
void |
setRestrictTo(java.lang.String path) |
void |
setSkipSetters(java.lang.Boolean cfgOnly) |
java.lang.String |
toString() |
void |
validate() |
addProperty, appendProperties, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
private java.lang.String key
private java.lang.String classname
private java.lang.String restrictTo
private java.lang.Boolean skipSetters
private ToolConfiguration.Status status
private java.lang.Throwable problem
public void setKey(java.lang.String key)
public void setClass(java.lang.Class clazz)
public void setClassname(java.lang.String classname)
public void setRestrictTo(java.lang.String path)
public void setSkipSetters(java.lang.Boolean cfgOnly)
public java.lang.String getKey()
getDefaultKey()
.public java.lang.String getDefaultKey()
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.public java.lang.String getClassname()
public java.lang.Class getToolClass()
public java.lang.String[] getInvalidScopes()
public java.lang.String[] getValidScopes()
private final ToolConfiguration.Status getStatus()
private void digForDependencies(java.lang.Class clazz)
public java.lang.String getRestrictTo()
public java.lang.Boolean getSkipSetters()
public ToolInfo createInfo()
private final java.lang.String getError(ToolConfiguration.Status status)
public void addConfiguration(Configuration config)
addConfiguration
in class Configuration
public void validate()
validate
in class Configuration
public int compareTo(Configuration conf)
compareTo
in interface java.lang.Comparable<Configuration>
compareTo
in class Configuration
public int hashCode()
hashCode
in class Configuration
public boolean equals(java.lang.Object obj)
equals
in class Configuration
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2003-2007 Apache Software Foundation