org.apache.velocity.tools.config
Class Data
java.lang.Object
org.apache.velocity.tools.config.Data
- All Implemented Interfaces:
- Comparable<Data>
- Direct Known Subclasses:
- Property
public class Data
- extends Object
- implements Comparable<Data>
This class represents configured data. If added to a
FactoryConfiguration, its values will be made
available in the application-scoped toolboxes
produced by any ToolboxFactory configured using
that configuration.
This class also implements all the functionality of
Propertys, which may added to any
Configuration subclass, including
ToolConfiguration, ToolboxConfiguration,
and FactoryConfiguration. In other words,
anything you can do in a Data configuration, you
can do with a Property.
Some features supported here are:
- built in
Data.Types for strings, booleans, numbers, fields
and lists thereof
- auto-conversion of numbers, booleans and fields in data
with no explicit type
- support for any Commons-BeanUtils
Converter implementation
- Version:
- $Id: Data.java 511959 2007-02-26 19:24:39Z nbubna $
- Author:
- Nathan Bubna
|
Constructor Summary |
Data()
|
DEFAULT_TYPE
protected static final Data.Type DEFAULT_TYPE
Data
public Data()
setKey
public void setKey(String key)
setValue
public void setValue(Object value)
setClassname
public void setClassname(String classname)
setClass
public void setClass(String classname)
- This doesn't take a
Class parameter because
this class was not created for all-java configuration.
setType
protected void setType(Data.Type type)
setType
public void setType(String t)
setTargetClass
public void setTargetClass(Class clazz)
setConverter
public void setConverter(Class clazz)
setConverter
public void setConverter(String classname)
convertWith
public void convertWith(org.apache.commons.beanutils.Converter converter)
- This is a convenience method for those doing configuration in java.
It cannot be named setConverter(), or else it would confuse BeanUtils.
getKey
public String getKey()
getType
public String getType()
getValue
public Object getValue()
getTargetClass
public Class getTargetClass()
getConverter
public org.apache.commons.beanutils.Converter getConverter()
getConvertedValue
public Object getConvertedValue()
validate
public void validate()
compareTo
public int compareTo(Data datum)
- Specified by:
compareTo in interface Comparable<Data>
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
toString
public String toString()
- Overrides:
toString in class Object
convert
protected Object convert(Object value)
Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.