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
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
protected static class
protected static enum
Delineates the standard, known types and their associated target classes (setTargetClass(java.lang.Class)
and converters (setConverter(java.lang.Class)
). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
protected Object
private List
convertList
(Object val) private Object
convertValue
(Object value) void
convertWith
(Converter converter) This is a convenience method for those doing configuration in java.boolean
Converter
getKey()
getType()
getValue()
int
hashCode()
void
This doesn't take aClass
parameter because this class was not created for all-java configuration.void
setClassname
(String classname) void
setConverter
(Class clazz) void
setConverter
(String classname) void
void
setTargetClass
(Class clazz) void
protected void
void
toString()
void
validate()
-
Field Details
-
DEFAULT_TYPE
-
key
-
typeValue
-
value
-
isList
private boolean isList -
target
-
converter
private Converter converter
-
-
Constructor Details
-
Data
public Data()
-
-
Method Details
-
setKey
-
setValue
-
setClassname
-
setClass
This doesn't take aClass
parameter because this class was not created for all-java configuration. -
setType
-
setType
-
setTargetClass
-
setConverter
-
setConverter
-
convertWith
public void convertWith(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
-
getType
-
getValue
-
getTargetClass
-
getConverter
public Converter getConverter() -
getConvertedValue
-
validate
public void validate() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Data>
-
hashCode
public int hashCode() -
equals
-
toString
-
convert
-
convertValue
-
convertList
-