Package com.bloomberglp.blpapi
Class Constant
java.lang.Object
com.bloomberglp.blpapi.Constant
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Schema.Datatype
datatype()
Return the Datatype used to represent the value of this Constantabstract String
Returns a String containing a human readable description of this Constantabstract char
Return the value of this Constant as a char if it can be convertedabstract Datetime
Deprecated.abstract Datetime
Return the value of this Constant as a Datetime if it can be convertedabstract float
Return the value of this Constant as a Float32 if it can be convertedabstract double
Return the value of this Constant as a Float64 if it can be convertedabstract int
Return the value of this Constant as an Int32 if it can be convertedabstract long
Return the value of this Constant as an Int64 if it can be convertedabstract String
Return the value of this Constant as a String if it can be convertedabstract Datetime
Deprecated.since 3.2.1 UsegetValueAsDatetime()
insteadabstract Name
name()
Returns the symbolic name of the constantabstract void
setUserData
(Object userData) Set the user data associated with this Constant to the specified userData.abstract Schema.Status
status()
Returns the status of this Constantabstract Object
userData()
Returns the user data associated with this Constant.
-
Constructor Details
-
Constant
public Constant()
-
-
Method Details
-
setUserData
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
Returns the symbolic name of the constant- Returns:
- name
-
description
Returns a String containing a human readable description of this Constant- Returns:
- description
-
status
Returns the status of this Constant- Returns:
- status
- See Also:
-
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
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
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.since 3.2.1 UsegetValueAsDatetime()
instead -
getValueAsTime
Deprecated.since 3.2.1 UsegetValueAsDatetime()
instead -
userData
Returns the user data associated with this Constant. IfsetUserData(Object)
has never been called for this Constant then return null
-
getValueAsDatetime()
instead