|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.config.Configuration
org.apache.velocity.tools.config.CompoundConfiguration<ToolboxConfiguration>
org.apache.velocity.tools.config.FactoryConfiguration
public class FactoryConfiguration
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.
Field Summary | |
---|---|
private java.util.SortedSet<Data> |
data
|
private java.util.List<java.lang.String> |
sources
|
Constructor Summary | |
---|---|
|
FactoryConfiguration()
|
protected |
FactoryConfiguration(java.lang.Class clazz,
java.lang.String source)
Allows subclasses to construct an instance that uses their classname. |
|
FactoryConfiguration(java.lang.String source)
Creates a new instance with the specified source name combined with this class's name as the initial source. |
Method Summary | |
---|---|
void |
addConfiguration(FactoryConfiguration config)
|
void |
addData(Data newDatum)
|
void |
addSource(java.lang.String source)
|
void |
addToolbox(ToolboxConfiguration toolbox)
|
ToolboxFactory |
createFactory()
|
boolean |
equals(java.lang.Object o)
This will consider the object equal if it is a FactoryConfiguration and whose toString(boolean) method, when passed false ,
returns a String equal to that returned by a call to toString(false) on this
instance. |
java.util.SortedSet<Data> |
getData()
|
Data |
getData(Data findme)
|
Data |
getData(java.lang.String key)
|
java.lang.String |
getSource()
Returns the original source of this particular instance. |
java.util.List<java.lang.String> |
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. |
ToolboxConfiguration |
getToolbox(java.lang.String scope)
|
java.util.Collection<ToolboxConfiguration> |
getToolboxes()
|
boolean |
hasData()
|
int |
hashCode()
|
boolean |
removeData(Data datum)
|
void |
removeToolbox(ToolboxConfiguration toolbox)
|
void |
setData(java.util.Collection<Data> data)
|
void |
setSource(java.lang.String source)
Sets the name of the original source of this particular instance. |
void |
setToolboxes(java.util.Collection<ToolboxConfiguration> toolboxes)
|
java.lang.String |
toString()
|
java.lang.String |
toString(boolean includeSources)
|
void |
validate()
|
Methods inherited from class org.apache.velocity.tools.config.CompoundConfiguration |
---|
addChild, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildren |
Methods inherited from class org.apache.velocity.tools.config.Configuration |
---|
addConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final java.util.SortedSet<Data> data
private final java.util.List<java.lang.String> sources
Constructor Detail |
---|
public FactoryConfiguration()
public FactoryConfiguration(java.lang.String source)
protected FactoryConfiguration(java.lang.Class clazz, java.lang.String source)
Method Detail |
---|
public java.lang.String getSource()
public void setSource(java.lang.String source)
public java.util.List<java.lang.String> getSources()
public void addSource(java.lang.String source)
public void addData(Data newDatum)
public boolean removeData(Data datum)
public Data getData(java.lang.String key)
public Data getData(Data findme)
public boolean hasData()
public java.util.SortedSet<Data> getData()
public void setData(java.util.Collection<Data> data)
public void addToolbox(ToolboxConfiguration toolbox)
public void removeToolbox(ToolboxConfiguration toolbox)
public ToolboxConfiguration getToolbox(java.lang.String scope)
public java.util.Collection<ToolboxConfiguration> getToolboxes()
public void setToolboxes(java.util.Collection<ToolboxConfiguration> toolboxes)
public void addConfiguration(FactoryConfiguration config)
public void validate()
validate
in class CompoundConfiguration<ToolboxConfiguration>
public boolean equals(java.lang.Object o)
toString(boolean)
method, when passed false
,
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.
equals
in class CompoundConfiguration<ToolboxConfiguration>
public int hashCode()
hashCode
in class CompoundConfiguration<ToolboxConfiguration>
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean includeSources)
public ToolboxFactory createFactory()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |