Package com.yahoo.data.access.simple
Class Value
java.lang.Object
com.yahoo.data.access.simple.Value
- All Implemented Interfaces:
Inspectable,Inspector
- Direct Known Subclasses:
MatchFeatureData.HitValue,Value.ArrayValue,Value.BoolValue,Value.DataValue,Value.DoubleValue,Value.EmptyValue,Value.LongValue,Value.ObjectValue,Value.StringValue
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanasBool()Access the inspector's value if it's a BOOLEAN; otherwise throws exceptionbooleanasBool(boolean defaultValue) Get the inspector's value (or the supplied default), never throwsbyte[]asData()Access the inspector's value if it's DATA; otherwise throws exceptionbyte[]asData(byte[] defaultValue) Get the inspector's value (or the supplied default), never throwsdoubleasDouble()Access the inspector's value if it's a DOUBLE (or LONG); otherwise throws exceptiondoubleasDouble(double defaultValue) Get the inspector's value (or the supplied default), never throwslongasLong()Access the inspector's value if it's a LONG (or DOUBLE); otherwise throws exceptionlongasLong(long defaultValue) Get the inspector's value (or the supplied default), never throwsasString()Access the inspector's value if it's a STRING; otherwise throws exceptionGet the inspector's value (or the supplied default), never throwsbyte[]asUtf8()Access the inspector's value (in utf-8 representation) if it's a STRING; otherwise throws exceptionbyte[]asUtf8(byte[] defaultValue) Get the inspector's value (or the supplied default), never throwsstatic Inspectorempty()entries()Convert an array to an iterable list.entry(int idx) Access an array entry.intGet the number of entries in an ARRAY (always returns 0 for non-arrays)Access an field in an object.intGet the number of fields in an OBJECT (always returns 0 for non-objects)fields()Convert an object to an iterable list of (name, value) pairs.inspect()Returns an Inspector exposing this object's structured data.static Inspectorinvalid()toJson()toString()voidTraverse an array value, performing callbacks for each entry.voidTraverse an object value, performing callbacks for each field.type()Get the type of an inspectorbooleanvalid()Check if the inspector is valid.writeJson(StringBuilder target)
-
Constructor Details
-
Value
public Value()
-
-
Method Details
-
empty
-
invalid
-
inspect
Description copied from interface:InspectableReturns an Inspector exposing this object's structured data.- Specified by:
inspectin interfaceInspectable
-
valid
public boolean valid()Description copied from interface:InspectorCheck if the inspector is valid. If you try to access a field or array entry that does not exist, you will get an invalid Inspector returned. -
type
Description copied from interface:InspectorGet the type of an inspector -
entryCount
public int entryCount()Description copied from interface:InspectorGet the number of entries in an ARRAY (always returns 0 for non-arrays)- Specified by:
entryCountin interfaceInspector
-
fieldCount
public int fieldCount()Description copied from interface:InspectorGet the number of fields in an OBJECT (always returns 0 for non-objects)- Specified by:
fieldCountin interfaceInspector
-
asBool
public boolean asBool()Description copied from interface:InspectorAccess the inspector's value if it's a BOOLEAN; otherwise throws exception -
asLong
public long asLong()Description copied from interface:InspectorAccess the inspector's value if it's a LONG (or DOUBLE); otherwise throws exception -
asDouble
public double asDouble()Description copied from interface:InspectorAccess the inspector's value if it's a DOUBLE (or LONG); otherwise throws exception -
asString
Description copied from interface:InspectorAccess the inspector's value if it's a STRING; otherwise throws exception -
asUtf8
public byte[] asUtf8()Description copied from interface:InspectorAccess the inspector's value (in utf-8 representation) if it's a STRING; otherwise throws exception -
asData
public byte[] asData()Description copied from interface:InspectorAccess the inspector's value if it's DATA; otherwise throws exception -
asBool
public boolean asBool(boolean defaultValue) Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
asLong
public long asLong(long defaultValue) Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
asDouble
public double asDouble(double defaultValue) Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
asString
Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
asUtf8
public byte[] asUtf8(byte[] defaultValue) Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
asData
public byte[] asData(byte[] defaultValue) Description copied from interface:InspectorGet the inspector's value (or the supplied default), never throws -
traverse
Description copied from interface:InspectorTraverse an array value, performing callbacks for each entry. If the current Inspector is connected to an array value, perform callbacks to the given traverser for each entry contained in the array. Otherwise a no-op. -
traverse
Description copied from interface:InspectorTraverse an object value, performing callbacks for each field. If the current Inspector is connected to an object value, perform callbacks to the given traverser for each field contained in the object. Otherwise a no-op. -
entry
Description copied from interface:InspectorAccess an array entry. If the current Inspector doesn't connect to an array value, or the given array index is out of bounds, the returned Inspector will be invalid. -
field
Description copied from interface:InspectorAccess an field in an object. If the current Inspector doesn't connect to an object value, or the object value does not contain a field with the given symbol name, the returned Inspector will be invalid. -
entries
Description copied from interface:InspectorConvert an array to an iterable list. Other types will just return an empty list. -
fields
Description copied from interface:InspectorConvert an object to an iterable list of (name, value) pairs. Other types will just return an empty list. -
writeJson
-
toJson
-
toString
-