Package 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 anyConfigurationsubclass, includingToolConfiguration,ToolboxConfiguration, andFactoryConfiguration. In other words, anything you can do in aDataconfiguration, you can do with aProperty.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
Converterimplementation
- Version:
- $Id: Data.java 511959 2007-02-26 19:24:39Z nbubna $
- Author:
- Nathan Bubna
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classData.AutoConverterprotected static classData.FieldConverterprotected static classData.NumberConverterprotected static classData.TypeDelineates the standard, known types and their associated target classes (setTargetClass(java.lang.Class)and converters (setConverter(java.lang.Class)).
-
Field Summary
Fields Modifier and Type Field Description protected static Data.TypeDEFAULT_TYPE
-
Constructor Summary
Constructors Constructor Description Data()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Data datum)protected Objectconvert(Object value)voidconvertWith(org.apache.commons.beanutils.Converter converter)This is a convenience method for those doing configuration in java.booleanequals(Object obj)ObjectgetConvertedValue()org.apache.commons.beanutils.ConvertergetConverter()StringgetKey()ClassgetTargetClass()StringgetType()ObjectgetValue()inthashCode()voidsetClass(String classname)This doesn't take aClassparameter because this class was not created for all-java configuration.voidsetClassname(String classname)voidsetConverter(Class clazz)voidsetConverter(String classname)voidsetKey(String key)voidsetTargetClass(Class clazz)voidsetType(String t)protected voidsetType(Data.Type type)voidsetValue(Object value)StringtoString()voidvalidate()
-
-
-
Field Detail
-
DEFAULT_TYPE
protected static final Data.Type DEFAULT_TYPE
-
-
Method Detail
-
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 aClassparameter 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:
compareToin interfaceComparable<Data>
-
-