类 FactoryConfiguration
- 所有已实现的接口:
Comparable<Configuration>
This class serves to define configuration info for a ToolboxFactory
.
It contains the ToolboxConfiguration
s for the factory as well
as any Data
which is to be made available in the application scope
by the factory and any Property
s which you intend to be available
to all tools managed by the factory, regardless of
toolbox or scope.
Most users will not find themselves directly using the API of this class, as its subclasses generally provide much simpler means of inputting the actual configuration info whether from XML, Java or a Properties files.
When combining any Configuration
s via the various
addConfiguration(org.apache.velocity.tools.config.FactoryConfiguration)
methods in each class, it is
essential to remember that subsequent configurations
always override previous ones. This is a "last entry wins" approach
to configuration!
For debugging, this class tracks its "sources", keeping a chronological list
of all sources for configuration data. When you add configuration info
to this class via addConfiguration(org.apache.velocity.tools.config.FactoryConfiguration)
, the source lists from those
FactoryConfiguration
s is appended to this instance's list. The
initial item in this list will typically be the name of the FactoryConfiguration
class (or subclass) along with a caller-provided string identifying where
this instance was created. This aids greatly in debugging combined, complex
configurations. You may add further sources at any time via
addSource(java.lang.String)
.
The toString()
method of this class provides a complete and
well-formatted listing of the configuration info contained within this
instance and is also very useful for debugging.
- 版本:
- $Id: FactoryConfiguration.java 511959 2007-02-26 19:24:39Z nbubna $
- 作者:
- Nathan Bubna
-
字段概要
字段 -
构造器概要
构造器限定符构造器说明protected
FactoryConfiguration
(Class clazz, String source) Allows subclasses to construct an instance that uses their classname.FactoryConfiguration
(String source) Creates a new instance with the specified source name combined with this class's name as the initial source. -
方法概要
修饰符和类型方法说明void
addConfiguration
(FactoryConfiguration config) void
void
void
addToolbox
(ToolboxConfiguration toolbox) boolean
This will consider the object equal if it is a FactoryConfiguration and whosetoString(boolean)
method, when passedfalse
, returns a String equal to that returned by a call to toString(false) on this instance.getData()
Returns the original source of this particular instance.Returns the list of sources for this configuration info in order starting from the source name given to this instance (if any) and going to the most recently added source.getToolbox
(String scope) boolean
hasData()
int
hashCode()
boolean
removeData
(Data datum) void
removeToolbox
(ToolboxConfiguration toolbox) void
setData
(Collection<Data> data) void
Sets the name of the original source of this particular instance.void
setToolboxes
(Collection<ToolboxConfiguration> toolboxes) toString()
toString
(boolean includeSources) void
validate()
从类继承的方法 org.apache.velocity.tools.config.CompoundConfiguration
addChild, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildren
从类继承的方法 org.apache.velocity.tools.config.Configuration
addConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
-
字段详细资料
-
data
-
sources
-
-
构造器详细资料
-
FactoryConfiguration
public FactoryConfiguration() -
FactoryConfiguration
Creates a new instance with the specified source name combined with this class's name as the initial source. -
FactoryConfiguration
Allows subclasses to construct an instance that uses their classname.
-
-
方法详细资料
-
getSource
Returns the original source of this particular instance. -
setSource
Sets the name of the original source of this particular instance. This does not affect subsequently added sources. -
getSources
Returns the list of sources for this configuration info in order starting from the source name given to this instance (if any) and going to the most recently added source. -
addSource
-
addData
-
removeData
-
getData
-
getData
-
hasData
public boolean hasData() -
getData
-
setData
-
addToolbox
-
removeToolbox
-
getToolbox
-
getToolboxes
-
setToolboxes
-
addConfiguration
-
validate
public void validate() -
equals
This will consider the object equal if it is a FactoryConfiguration and whosetoString(boolean)
method, when passedfalse
, returns a String equal to that returned by a call to toString(false) on this instance.toString(boolean)
is used since that returns a String encompassing all relevant info about the configuration except for the source information. In other words, two FactoryConfigurations are considered equal if they have the same data, properties and toolboxes in String form. -
hashCode
public int hashCode() -
toString
-
toString
-
createFactory
-