Package com.yahoo.jrt
Class Value
java.lang.Object
com.yahoo.jrt.Value
- Direct Known Subclasses:
DataArray
,DataValue
,DoubleArray
,DoubleValue
,FloatArray
,FloatValue
,Int16Array
,Int16Value
,Int32Array
,Int32Value
,Int64Array
,Int64Value
,Int8Array
,Int8Value
,StringArray
,StringValue
A single value that may be either a parameter or a return value
associated with a Request
. Multiple values are bundled
together with the Values
class. The value type identifiers
are defined by the RPC protocol. Each identifier matches the value
of an ASCII character (listed after the Java class for the type).
Most Value subclasses that are constructed from a Java array will not copy the array. This enables the same data to back multiple Value objects, but it also means that the application should be careful not to change the backing data under the feet of a Value object.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
type identifier forDataValue
(x)static final byte
type identifier forDataArray
(X)static final byte
type identifier forDoubleValue
(d)static final byte
type identifier forDoubleArray
(D)static final byte
type identifier forFloatValue
(f)static final byte
type identifier forFloatArray
(F)static final byte
type identifier forInt16Value
(h)static final byte
type identifier forInt16Array
(H)static final byte
type identifier forInt32Value
(i)static final byte
type identifier forInt32Array
(I)static final byte
type identifier forInt64Value
(l)static final byte
type identifier forInt64Array
(L)static final byte
type identifier forInt8Value
(b)static final byte
type identifier forInt8Array
(B)static final byte
type identifier forStringValue
(s)static final byte
type identifier forStringArray
(S) -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
asData()
Interpret this value as aDataValue
and return the contents as an appropriate Java typebyte[][]
Interpret this value as aDataArray
and return the contents as an appropriate Java typedouble
asDouble()
Interpret this value as aDoubleValue
and return the contents as an appropriate Java typedouble[]
Interpret this value as aDoubleArray
and return the contents as an appropriate Java typefloat
asFloat()
Interpret this value as aFloatValue
and return the contents as an appropriate Java typefloat[]
Interpret this value as aFloatArray
and return the contents as an appropriate Java typeshort
asInt16()
Interpret this value as aInt16Value
and return the contents as an appropriate Java typeshort[]
Interpret this value as aInt16Array
and return the contents as an appropriate Java typeint
asInt32()
Interpret this value as aInt32Value
and return the contents as an appropriate Java typeint[]
Interpret this value as aInt32Array
and return the contents as an appropriate Java typelong
asInt64()
Interpret this value as aInt64Value
and return the contents as an appropriate Java typelong[]
Interpret this value as aInt64Array
and return the contents as an appropriate Java typebyte
asInt8()
Interpret this value as aInt8Value
and return the contents as an appropriate Java typebyte[]
Interpret this value as aInt8Array
and return the contents as an appropriate Java typeasString()
Interpret this value as aStringValue
and return the contents as an appropriate Java typeString[]
Interpret this value as aStringArray
and return the contents as an appropriate Java typecom.yahoo.text.Utf8Array
Interpret this value as aStringValue
and return the contents as an appropriate Java typeabstract int
count()
Obtain the number of entries stored in this value.abstract String
toString()
Force a proper toStringabstract byte
type()
Obtain the type identifier for this value
-
Field Details
-
INT8
public static final byte INT8type identifier forInt8Value
(b)- See Also:
-
INT8_ARRAY
public static final byte INT8_ARRAYtype identifier forInt8Array
(B)- See Also:
-
INT16
public static final byte INT16type identifier forInt16Value
(h)- See Also:
-
INT16_ARRAY
public static final byte INT16_ARRAYtype identifier forInt16Array
(H)- See Also:
-
INT32
public static final byte INT32type identifier forInt32Value
(i)- See Also:
-
INT32_ARRAY
public static final byte INT32_ARRAYtype identifier forInt32Array
(I)- See Also:
-
INT64
public static final byte INT64type identifier forInt64Value
(l)- See Also:
-
INT64_ARRAY
public static final byte INT64_ARRAYtype identifier forInt64Array
(L)- See Also:
-
FLOAT
public static final byte FLOATtype identifier forFloatValue
(f)- See Also:
-
FLOAT_ARRAY
public static final byte FLOAT_ARRAYtype identifier forFloatArray
(F)- See Also:
-
DOUBLE
public static final byte DOUBLEtype identifier forDoubleValue
(d)- See Also:
-
DOUBLE_ARRAY
public static final byte DOUBLE_ARRAYtype identifier forDoubleArray
(D)- See Also:
-
STRING
public static final byte STRINGtype identifier forStringValue
(s)- See Also:
-
STRING_ARRAY
public static final byte STRING_ARRAYtype identifier forStringArray
(S)- See Also:
-
DATA
public static final byte DATAtype identifier forDataValue
(x)- See Also:
-
DATA_ARRAY
public static final byte DATA_ARRAYtype identifier forDataArray
(X)- See Also:
-
-
Constructor Details
-
Value
public Value()
-
-
Method Details
-
type
public abstract byte type()Obtain the type identifier for this value- Returns:
- type identifier
-
count
public abstract int count()Obtain the number of entries stored in this value. This is 1 for basic data types and the size of the array for array types.- Returns:
- the number of entries stored in this value
-
asInt8
public byte asInt8()Interpret this value as aInt8Value
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt8Value
-
asInt8Array
public byte[] asInt8Array()Interpret this value as aInt8Array
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt8Array
-
asInt16
public short asInt16()Interpret this value as aInt16Value
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt16Value
-
asInt16Array
public short[] asInt16Array()Interpret this value as aInt16Array
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt16Array
-
asInt32
public int asInt32()Interpret this value as aInt32Value
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt32Value
-
asInt32Array
public int[] asInt32Array()Interpret this value as aInt32Array
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt32Array
-
asInt64
public long asInt64()Interpret this value as aInt64Value
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt64Value
-
asInt64Array
public long[] asInt64Array()Interpret this value as aInt64Array
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aInt64Array
-
asFloat
public float asFloat()Interpret this value as aFloatValue
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aFloatValue
-
asFloatArray
public float[] asFloatArray()Interpret this value as aFloatArray
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aFloatArray
-
asDouble
public double asDouble()Interpret this value as aDoubleValue
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aDoubleValue
-
asDoubleArray
public double[] asDoubleArray()Interpret this value as aDoubleArray
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aDoubleArray
-
asString
Interpret this value as aStringValue
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aStringValue
-
asUtf8Array
public com.yahoo.text.Utf8Array asUtf8Array()Interpret this value as aStringValue
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aUtf8Array
-
asStringArray
Interpret this value as aStringArray
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aStringArray
-
asData
public byte[] asData()Interpret this value as aDataValue
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aDataValue
-
asDataArray
public byte[][] asDataArray()Interpret this value as aDataArray
and return the contents as an appropriate Java type- Returns:
- the value contained in this object as a Java type
- Throws:
ClassCastException
- if this is not aDataArray
-
toString
Force a proper toString
-