Interface IDfValue


public interface IDfValue
This interface provides functionality for retrieving values stored in value objects.

Value objects provide a convenient way to store variant values, which are values storing the variant datatype. The variant datatype is used to declare variables that can hold one of many different types of data, as in the following example in Visual Basic:


 DfValue[] vals = new DfValue[num_attrs];
 for (int j = 0; j < num_attrs; j++)
 {
        vals[j] = myobject.getValue(myobject.getAttr(j).getName());
 }
 

Note that value objects are immutable. Refer to the DocbasicTM User's Guide for more information about the variant datatype. Refer to the Server Reference Manual for more information about value objects.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Represents the boolean datatype.
    static final int
    Represents the double datatype.
    static final int
    Represents the ID datatype.
    static final int
    Represents the integer datatype.
    static final int
    Represents the string datatype.
    static final int
    Represents the time datatype.
    static final int
    Represents an undefined datatype.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the contents of a value object as a boolean.
    double
    Returns the contents of a value object as a double.
    Returns the contents of a value object as an IDfId interface.
    int
    Returns the contents of a value object as a integer.
    Returns the contents of a value object as a string.
    Returns the contents of a value object as an IDfTime interface.
    int
    Indicates whether the value stored in the calling value object is less than, equal to, or greater than the value stored in a user-supplied value object.
    boolean
    equals(Object value)
    Indicates whether the value stored in the calling value object matches the value in a user-supplied value object.
    int
    Returns the datatype of a value stored in a value object.
  • Field Details

  • Method Details

    • asString

      String asString()
      Returns the contents of a value object as a string.

      Returns:
      the string value
    • asInteger

      int asInteger()
      Returns the contents of a value object as a integer.

      This method returns 0 if the value cannot be converted to an integer.

      Returns:
      the integer value
    • asBoolean

      boolean asBoolean()
      Returns the contents of a value object as a boolean.

      This method returns false if the value cannot be converted to a boolean, such as integers other than 0 or 1.

      Returns:
      the boolean value
    • asDouble

      double asDouble()
      Returns the contents of a value object as a double.

      This method returns 0 if the value cannot be converted to a double, such as a string.

      Returns:
      the double value
    • asTime

      IDfTime asTime()
      Returns the contents of a value object as an IDfTime interface.

      Returns:
      the IDfTime interface
    • asId

      IDfId asId()
      Returns the contents of a value object as an IDfId interface.

      Returns:
      the IDfId interface; Note that if the underlying value is not an object ID, the return value has no meaning.
    • getDataType

      int getDataType()
      Returns the datatype of a value stored in a value object.

      Returns:
      the datatype of the value stored in the value object; The following list explains the meaning of all possible returned integers:
       Value    Datatype
       0        Boolean
       1        Integer
       2        String
       3        ID
       4        Time, or date
       5        Double
       6        Undefined
       
    • equals

      boolean equals(Object value)
      Indicates whether the value stored in the calling value object matches the value in a user-supplied value object.

      Overrides:
      equals in class Object
      Parameters:
      value - an interface to the object containing the value that you want to test; Valid arguments are IDfValue, IDfID, IDfTime, and the following Java objects: Boolean, Integer, String, and Double.
      Returns:
      TRUE if the values are the same; FALSE if they are not.
    • compareTo

      int compareTo(IDfValue value) throws DfException
      Indicates whether the value stored in the calling value object is less than, equal to, or greater than the value stored in a user-supplied value object.

      The following list explains the meaning of all return values:

       Value    Meaning
       -1       Less Than
       0        Equal To
       1        Greater Than
       

      Parameters:
      value - an IDfValue interface to the object containing the value that you want to test against
      Returns:
      -1 if the value stored in the calling value object is less than the value stored in the user-supplied value object; 0 if the two values are equal; 1 if the value stored in the calling value object is greater than the value stored in the user-supplied value object
      Throws:
      DfException - if the types stored in the value objects do not match or if this method is called on a value of type boolean