org.apache.velocity.tools.config
Class Data

java.lang.Object
  extended by 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:

Version:
$Id: Data.java 511959 2007-02-26 19:24:39Z nbubna $
Author:
Nathan Bubna

Nested Class Summary
protected static class Data.AutoConverter
           
protected static class Data.FieldConverter
           
protected static class Data.NumberConverter
           
protected static class Data.Type
          Delineates the standard, known types and their associated target classes (setTargetClass(java.lang.Class) and converters (setConverter(java.lang.Class)).
 
Field Summary
protected static Data.Type DEFAULT_TYPE
           
 
Constructor Summary
Data()
           
 
Method Summary
 int compareTo(Data datum)
           
protected  Object convert(Object value)
           
 void convertWith(org.apache.commons.beanutils.Converter converter)
          This is a convenience method for those doing configuration in java.
 boolean equals(Object obj)
           
 Object getConvertedValue()
           
 org.apache.commons.beanutils.Converter getConverter()
           
 String getKey()
           
 Class getTargetClass()
           
 String getType()
           
 Object getValue()
           
 int hashCode()
           
 void setClass(String classname)
          This doesn't take a Class parameter because this class was not created for all-java configuration.
 void setClassname(String classname)
           
 void setConverter(Class clazz)
           
 void setConverter(String classname)
           
 void setKey(String key)
           
 void setTargetClass(Class clazz)
           
protected  void setType(Data.Type type)
           
 void setType(String t)
           
 void setValue(Object value)
           
 String toString()
           
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TYPE

protected static final Data.Type DEFAULT_TYPE
Constructor Detail

Data

public Data()
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 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.