IntegralTypepublic class IntegralType extends NumericType This class represents the types
byte, short int, long and char |
Constructors Summary |
---|
public IntegralType(String name, Class clazz, int enumType)
super(name, clazz, enumType);
|
Methods Summary |
---|
public java.lang.Number | getValue(java.lang.Number value)Converts the specified value into a value of this numeric type.
E.g. an Integer is converted into a Long, if this represents
the numeric type long.
Number ret = null;
if (value == null)
ret = null;
else if ("int".equals(getName()))
ret = new Integer(value.intValue());
else if ("long".equals(getName()))
ret = new Long(value.longValue());
else if ("byte".equals(getName()))
ret = new Byte(value.byteValue());
else if ("short".equals(getName()))
ret = new Short(value.shortValue());
return ret;
| public java.lang.Number | negate(java.lang.Number value)Returns -value.
Number ret = null;
if (value == null)
ret = null;
else if ("int".equals(getName()))
ret = new Integer(-value.intValue());
else if ("long".equals(getName()))
ret = new Long(-value.longValue());
else if ("byte".equals(getName()))
ret = new Byte((byte)-value.byteValue());
else if ("short".equals(getName()))
ret = new Short((short)-value.shortValue());
return ret;
|
|