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. 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
Constructor and Description
`ToolConfiguration()`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `addConfiguration(Configuration config)`
`int` `compareTo(Configuration conf)`
`ToolInfo` `createInfo()`
`boolean` `equals(Object obj)`
`String` `getClassname()`
`String` `getDefaultKey()` Returns the default key value for the set tool class.
`Class` `getFactory()`
`String` `getFactoryClassname()`
`String[]` `getInvalidScopes()`
`String` `getKey()` Returns the key set for this tool.
`String` `getRestrictTo()`
`Boolean` `getSkipSetters()`
`Class` `getToolClass()`
`String[]` `getValidScopes()`
`int` `hashCode()`
`void` `setClass(Class clazz)` Deprecated.
`void` `setClass(String classname)`
`void` `setClassname(String classname)`
`void` `setFactory(Class factory)`
`void` `setFactoryClassname(String factoryClassname)`
`void` `setKey(String key)`
`void` `setRestrictTo(String path)`
`void` `setSkipSetters(Boolean cfgOnly)`
`String` `toString()`
`void` `validate()`

### 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`

### Constructor Detail

#### ToolConfiguration

    public ToolConfiguration()

### Method Detail

#### setKey

    public void setKey(String key)

#### setClass

    @Deprecated
    public void setClass(Class clazz)

Deprecated.
This method should be avoided, since considered unsafe by the security manager.

Parameters:
  `clazz` - the Class
See Also:
  `setClassname(String classname)`

#### setClass

    public void setClass(String classname)

#### setClassname

    public void setClassname(String classname)

#### setFactory

    public void setFactory(Class factory)

#### setFactoryClassname

    public void setFactoryClassname(String factoryClassname)

#### 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 of `getDefaultKey()`.

Returns:
  tool key

#### getDefaultKey

    public 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.

Returns:
  default tool key

#### getClassname

    public String getClassname()

#### getFactoryClassname

    public String getFactoryClassname()

#### getToolClass

    public Class getToolClass()

#### getFactory

    public Class getFactory()

#### 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:
  `addConfiguration` in class `Configuration`

#### validate

    public void validate()

Overrides:
  `validate` in class `Configuration`

#### compareTo

    public int compareTo(Configuration conf)

Specified by:
  `compareTo` in interface `Comparable<Configuration>`
Overrides:
  `compareTo` in class `Configuration`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Configuration`

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Configuration`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`