org.apache.velocity.tools.config
Class Data
java.lang.Object
org.apache.velocity.tools.config.Data
- All Implemented Interfaces:
- java.lang.Comparable<Data>
- Direct Known Subclasses:
- Property
public class Data
- extends java.lang.Object
- implements java.lang.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
Property
s, 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.Type
s 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()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
DEFAULT_TYPE
protected static final Data.Type DEFAULT_TYPE
key
private java.lang.String key
typeValue
private java.lang.String typeValue
value
private java.lang.Object value
isList
private boolean isList
target
private java.lang.Class target
converter
private org.apache.commons.beanutils.Converter converter
Data
public Data()
setKey
public void setKey(java.lang.String key)
setValue
public void setValue(java.lang.Object value)
setClassname
public void setClassname(java.lang.String classname)
setClass
public void setClass(java.lang.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(java.lang.String t)
setTargetClass
public void setTargetClass(java.lang.Class clazz)
setConverter
public void setConverter(java.lang.Class clazz)
setConverter
public void setConverter(java.lang.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 java.lang.String getKey()
getType
public java.lang.String getType()
getValue
public java.lang.Object getValue()
getTargetClass
public java.lang.Class getTargetClass()
getConverter
public org.apache.commons.beanutils.Converter getConverter()
getConvertedValue
public java.lang.Object getConvertedValue()
validate
public void validate()
compareTo
public int compareTo(Data datum)
- Specified by:
compareTo
in interface java.lang.Comparable<Data>
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
convert
protected java.lang.Object convert(java.lang.Object value)
convertValue
private java.lang.Object convertValue(java.lang.Object value)
convertList
private java.util.List convertList(java.lang.Object val)
Copyright (c) 2003-2007 Apache Software Foundation