Class Constant

java.lang.Object
com.bloomberglp.blpapi.Constant

public abstract class Constant extends Object
Represents a constant value in the schema.

Constants can be any of the following DataTypes: BOOL, CHAR, BYTE, INT32, INT64, FLOAT32, FLOAT64, STRING, DATE, TIME, DATETIME. As well as the constants value this class also provides access to the symbolic name, description and status of the constant.

Constants are read-only and always created by the API, never by the application.

  • Constructor Details

    • Constant

      public Constant()
  • Method Details

    • setUserData

      public abstract void setUserData(Object userData)
      Set the user data associated with this Constant to the specified userData.
      Parameters:
      userData - user provided data that is to be associated with this ConstantsList
    • name

      public abstract Name name()
      Returns the symbolic name of the constant
      Returns:
      name
    • description

      public abstract String description()
      Returns a String containing a human readable description of this Constant
      Returns:
      description
    • status

      public abstract Schema.Status status()
      Returns the status of this Constant
      Returns:
      status
      See Also:
    • datatype

      public abstract Schema.Datatype datatype()
      Return the Datatype used to represent the value of this Constant
      Returns:
      data type
    • getValueAsChar

      public abstract char getValueAsChar()
      Return the value of this Constant as a char if it can be converted
      Returns:
      value as char
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to a char
    • getValueAsInt32

      public abstract int getValueAsInt32()
      Return the value of this Constant as an Int32 if it can be converted
      Returns:
      value as a 32bit integer
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to an Int32
    • getValueAsInt64

      public abstract long getValueAsInt64()
      Return the value of this Constant as an Int64 if it can be converted
      Returns:
      value as a 64bit integer
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to an Int64
    • getValueAsFloat32

      public abstract float getValueAsFloat32()
      Return the value of this Constant as a Float32 if it can be converted
      Returns:
      value as a 32bit floating point number
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to a Float32
    • getValueAsFloat64

      public abstract double getValueAsFloat64()
      Return the value of this Constant as a Float64 if it can be converted
      Returns:
      value as a 64bit floating point number
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to a Float64
    • getValueAsString

      public abstract String getValueAsString()
      Return the value of this Constant as a String if it can be converted
      Returns:
      value as a string
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to a String
    • getValueAsDatetime

      public abstract Datetime getValueAsDatetime()
      Return the value of this Constant as a Datetime if it can be converted
      Returns:
      value as a date time
      Throws:
      InvalidConversionException - if the value of this Constant cannot be converted to a Datetime
    • getValueAsDate

      @Deprecated public abstract Datetime getValueAsDate()
      Deprecated.
      since 3.2.1 Use getValueAsDatetime() instead
    • getValueAsTime

      @Deprecated public abstract Datetime getValueAsTime()
      Deprecated.
      since 3.2.1 Use getValueAsDatetime() instead
    • userData

      public abstract Object userData()
      Returns the user data associated with this Constant. If setUserData(Object) has never been called for this Constant then return null