java.lang.Object
dev.openfeature.sdk.Value
- All Implemented Interfaces:
Cloneable
Values serve as a generic return type for structure data from providers.
Providers may deal in JSON, protobuf, XML or some other data-interchange format.
This intermediate representation provides a good medium of exchange.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the underlying Boolean value, or null.asDouble()Retrieve the underlying numeric value as a Double, or null.Retrieve the underlying Instant value, or null.Retrieve the underlying numeric value as an Integer, or null.asList()Retrieve the underlying List value, or null.asObject()Retrieve the underlying object.asString()Retrieve the underlying String value, or null.Retrieve the underlying Structure value, or null.protected Valueclone()Perform deep clone of value object.protected final voidfinalize()booleanCheck if this Value represents a Boolean.booleanCheck if this Value represents an Instant.booleanisList()Check if this Value represents a List of Values.booleanisNull()Check if this Value represents null.booleanisNumber()Check if this Value represents a numeric value.booleanisString()Check if this Value represents a String.booleanCheck if this Value represents a Structure.static ValueobjectToValue(Object object) Wrap an object into a Value.
-
Constructor Details
-
Value
public Value()Construct a new null Value. -
Value
Construct a new Value with an Object.- Parameters:
value- to be wrapped.- Throws:
InstantiationException- if value is not a valid type (boolean, string, int, double, list, structure, instant)
-
Value
-
Value
-
Value
-
Value
-
Value
-
Value
-
Value
-
Value
-
-
Method Details
-
finalize
protected final void finalize() -
isNull
public boolean isNull()Check if this Value represents null.- Returns:
- boolean
-
isBoolean
public boolean isBoolean()Check if this Value represents a Boolean.- Returns:
- boolean
-
isString
public boolean isString()Check if this Value represents a String.- Returns:
- boolean
-
isNumber
public boolean isNumber()Check if this Value represents a numeric value.- Returns:
- boolean
-
isStructure
public boolean isStructure()Check if this Value represents a Structure.- Returns:
- boolean
-
isList
public boolean isList()Check if this Value represents a List of Values.- Returns:
- boolean
-
isInstant
public boolean isInstant()Check if this Value represents an Instant.- Returns:
- boolean
-
asBoolean
Retrieve the underlying Boolean value, or null.- Returns:
- Boolean
-
asObject
Retrieve the underlying object.- Returns:
- Object
-
asString
Retrieve the underlying String value, or null.- Returns:
- String
-
asInteger
Retrieve the underlying numeric value as an Integer, or null. If the value is not an integer, it will be rounded using Math.round().- Returns:
- Integer
-
asDouble
Retrieve the underlying numeric value as a Double, or null.- Returns:
- Double
-
asStructure
Retrieve the underlying Structure value, or null.- Returns:
- Structure
-
asList
Retrieve the underlying List value, or null.- Returns:
- List
-
asInstant
Retrieve the underlying Instant value, or null.- Returns:
- Instant
-
clone
Perform deep clone of value object. -
objectToValue
Wrap an object into a Value.- Parameters:
object- the object to wrap- Returns:
- the wrapped object
-