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
FieldsModifier and TypeFieldDescriptionstatic final bytetype identifier forDataValue(x)static final bytetype identifier forDataArray(X)static final bytetype identifier forDoubleValue(d)static final bytetype identifier forDoubleArray(D)static final bytetype identifier forFloatValue(f)static final bytetype identifier forFloatArray(F)static final bytetype identifier forInt16Value(h)static final bytetype identifier forInt16Array(H)static final bytetype identifier forInt32Value(i)static final bytetype identifier forInt32Array(I)static final bytetype identifier forInt64Value(l)static final bytetype identifier forInt64Array(L)static final bytetype identifier forInt8Value(b)static final bytetype identifier forInt8Array(B)static final bytetype identifier forStringValue(s)static final bytetype identifier forStringArray(S) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asData()Interpret this value as aDataValueand return the contents as an appropriate Java typebyte[][]Interpret this value as aDataArrayand return the contents as an appropriate Java typedoubleasDouble()Interpret this value as aDoubleValueand return the contents as an appropriate Java typedouble[]Interpret this value as aDoubleArrayand return the contents as an appropriate Java typefloatasFloat()Interpret this value as aFloatValueand return the contents as an appropriate Java typefloat[]Interpret this value as aFloatArrayand return the contents as an appropriate Java typeshortasInt16()Interpret this value as aInt16Valueand return the contents as an appropriate Java typeshort[]Interpret this value as aInt16Arrayand return the contents as an appropriate Java typeintasInt32()Interpret this value as aInt32Valueand return the contents as an appropriate Java typeint[]Interpret this value as aInt32Arrayand return the contents as an appropriate Java typelongasInt64()Interpret this value as aInt64Valueand return the contents as an appropriate Java typelong[]Interpret this value as aInt64Arrayand return the contents as an appropriate Java typebyteasInt8()Interpret this value as aInt8Valueand return the contents as an appropriate Java typebyte[]Interpret this value as aInt8Arrayand return the contents as an appropriate Java typeasString()Interpret this value as aStringValueand return the contents as an appropriate Java typeString[]Interpret this value as aStringArrayand return the contents as an appropriate Java typecom.yahoo.text.Utf8ArrayInterpret this value as aStringValueand return the contents as an appropriate Java typeabstract intcount()Obtain the number of entries stored in this value.abstract StringtoString()Force a proper toStringabstract bytetype()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 aInt8Valueand 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 aInt8Arrayand 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 aInt16Valueand 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 aInt16Arrayand 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 aInt32Valueand 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 aInt32Arrayand 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 aInt64Valueand 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 aInt64Arrayand 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 aFloatValueand 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 aFloatArrayand 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 aDoubleValueand 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 aDoubleArrayand 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 aStringValueand 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 aStringValueand 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 aStringArrayand 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 aDataValueand 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 aDataArrayand 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
-