net.sf.antcontrib.property
Class Num
java.lang.Object
|
+--net.sf.antcontrib.property.Num
- public class Num
- extends java.lang.Object
Represents a number.
Developed for use with Antelope, migrated to ant-contrib Oct 2003.
- Version:
- $Revision: 1.2 $
- Author:
- Dale Anson, danson@germane-software.com
Constructor Summary |
Num()
|
Method Summary |
java.lang.String |
getDatatype()
|
java.lang.Number |
getValue()
|
void |
setDatatype(java.lang.String p)
Sets the datatype of this number. |
void |
setValue(java.lang.String value)
Set the value for this number. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Num
public Num()
setValue
public void setValue(java.lang.String value)
- Set the value for this number. This string must parse to the set
datatype, for example, setting value to "7.992" and datatype to INT
will cause a number format exception to be thrown. Supports two special
numbers, "E" and "PI".
- Parameters:
value
- the value for this number
getValue
public java.lang.Number getValue()
- Returns:
- the value for this number as a Number. Cast as appropriate to
Integer, Long, Float, or Double.
setDatatype
public void setDatatype(java.lang.String p)
- Sets the datatype of this number. Allowed values are
"int", "long", "float", or "double".
getDatatype
public java.lang.String getDatatype()
- Returns:
- the datatype as one of the defined types.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object