FileDocCategorySizeDatePackage
NumericValueExp.javaAPI DocJava SE 5 API6314Fri Aug 26 14:57:34 BST 2005javax.management

NumericValueExp

public class NumericValueExp extends QueryEval implements ValueExp
This class represents numbers that are arguments to relational constraints. A NumericValueExp may be used anywhere a ValueExp is required.
serial
include
since
1.5

Fields Summary
private static final long
oldSerialVersionUID
private static final long
newSerialVersionUID
private static final ObjectStreamField[]
oldSerialPersistentFields
private static final ObjectStreamField[]
newSerialPersistentFields
private static final long
serialVersionUID
private static final ObjectStreamField[]
serialPersistentFields
private static boolean
compat
private Number
val
Constructors Summary
public NumericValueExp()
Basic constructor.

        
              
       
    
NumericValueExp(Number val)
Creates a new NumericValue representing the numeric literal .

      this.val = val;
    
Methods Summary
public javax.management.ValueExpapply(javax.management.ObjectName name)
Applies the ValueExp on a MBean.

param
name The name of the MBean on which the ValueExp will be applied.
return
The ValueExp.
exception
BadStringOperationException
exception
BadBinaryOpValueExpException
exception
BadAttributeValueExpException
exception
InvalidApplicationException

 
	return this;
    
public doubledoubleValue()
Returns a double numeric value

 
      if (val instanceof Long || val instanceof Integer)
      {
        return (double)(val.longValue());
      }
      return val.doubleValue();
    
public booleanisLong()
Returns true is if the numeric value is a long, false otherwise.

 
	return (val instanceof Long || val instanceof Integer);
    
public longlongValue()
Returns a long numeric value

 
      if (val instanceof Long || val instanceof Integer)
      {
        return val.longValue();
      }
      return (long)(val.doubleValue());
    
private voidreadObject(java.io.ObjectInputStream in)
Deserializes a {@link NumericValueExp} from an {@link ObjectInputStream}.

      if (compat)
      {
        // Read an object serialized in the old serial form
        //
        double doubleVal;
        long longVal;
        boolean isLong;
        ObjectInputStream.GetField fields = in.readFields();
        doubleVal = fields.get("doubleVal", (double)0);
	if (fields.defaulted("doubleVal"))
        {
          throw new NullPointerException("doubleVal");
        }
        longVal = fields.get("longVal", (long)0);
	if (fields.defaulted("longVal"))
        {
          throw new NullPointerException("longVal");
        }
        isLong = fields.get("valIsLong", false);
	if (fields.defaulted("valIsLong"))
        {
          throw new NullPointerException("valIsLong");
        }
        if (isLong)
        {
          this.val = new Long(longVal);
        }
        else
        {
          this.val = new Double(doubleVal);
        }
      }
      else
      {
        // Read an object serialized in the new serial form
        //
        in.defaultReadObject();
      }
    
public java.lang.StringtoString()
Returns the string representing the object

 
      if (val instanceof Long || val instanceof Integer)
      {
        return String.valueOf(val.longValue());
      }
      return String.valueOf(val.doubleValue());
    
private voidwriteObject(java.io.ObjectOutputStream out)
Serializes a {@link NumericValueExp} to an {@link ObjectOutputStream}.

      if (compat)
      {
        // Serializes this instance in the old serial form
        //
        ObjectOutputStream.PutField fields = out.putFields();
	fields.put("doubleVal", doubleValue());
	fields.put("longVal", longValue());
	fields.put("valIsLong", isLong());
	out.writeFields();
      }
      else
      {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
      }