package javax.management;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
class NumericValueExp extends QueryEval implements ValueExp
{
private static final long serialVersionUID = -4679739485102359104L;
private static final ObjectStreamField[] serialPersistentFields;
private Number val;
static
{
serialPersistentFields = new ObjectStreamField[]
{
new ObjectStreamField("val", Number.class),
};
}
public NumericValueExp()
{
this.val = new Double(0.0);
}
public NumericValueExp(Number value)
{
this.val = value;
}
public boolean isInteger()
{
return val instanceof Integer || val instanceof Long;
}
public double getLongValue()
{
return val.longValue();
}
public double getDoubleValue()
{
return val.doubleValue();
}
public ValueExp apply(ObjectName name)
throws BadStringOperationException,
BadBinaryOpValueExpException,
BadAttributeValueExpException,
InvalidApplicationException
{
return this;
}
public String toString()
{
return val.toString();
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
{
ois.defaultReadObject();
}
private void writeObject(ObjectOutputStream oos) throws IOException
{
oos.defaultWriteObject();
}
}