org.apache.velocity.tools.view
Class DataInfo
java.lang.Object
|
+--org.apache.velocity.tools.view.DataInfo
- All Implemented Interfaces:
- ToolInfo
- public class DataInfo
- extends java.lang.Object
- implements ToolInfo
ToolInfo implementation to handle "primitive" data types.
It currently supports String, Number, and Boolean data.
An example of data elements specified in your toolbox.xml
might be:
<data type="string">
<key>app_name</key>
<value>FooWeb Deluxe</value>
</data>
<data type="number">
<key>app_version</key>
<value>4.2</value>
</data>
<data type="boolean">
<key>debug</key>
<value>true</value>
</data>
<data type="number">
<key>screen_width</key>
<value>400</value>
</data>
- Version:
- $Id: DataInfo.java,v 1.3 2003/05/28 00:17:15 nbubna Exp $
- Author:
- Nathan Bubna
Constructor Summary |
DataInfo(java.lang.String key,
java.lang.String type,
java.lang.String value)
Parses the value string into a recognized type. |
Method Summary |
java.lang.String |
getClassname()
|
java.lang.Object |
getInstance(java.lang.Object initData)
Returns the data. |
java.lang.String |
getKey()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TYPE_STRING
public static java.lang.String TYPE_STRING
TYPE_NUMBER
public static java.lang.String TYPE_NUMBER
TYPE_BOOLEAN
public static java.lang.String TYPE_BOOLEAN
key
private java.lang.String key
data
private java.lang.Object data
DataInfo
public DataInfo(java.lang.String key,
java.lang.String type,
java.lang.String value)
- Parses the value string into a recognized type. If
the type specified is not supported, the data will
be held and returned as a string.
- Parameters:
key
- the context key for the datatype
- the data typevalue
- the data
getKey
public java.lang.String getKey()
- Specified by:
getKey
in interface ToolInfo
- Returns:
- the context key for the tool
getClassname
public java.lang.String getClassname()
- Specified by:
getClassname
in interface ToolInfo
- Returns:
- the fully qualified classname for the tool
getInstance
public java.lang.Object getInstance(java.lang.Object initData)
- Returns the data. Always returns the same
object since the data is a constant. Initialization
data is ignored.
- Specified by:
getInstance
in interface ToolInfo
- Parameters:
initData
- an object that may be used to initialize the instance
- Returns:
- an instance of the tool
Copyright (c) 2003 Apache Software Foundation