Package com.yahoo.slime
Class BinaryView
java.lang.Object
com.yahoo.slime.BinaryView
- All Implemented Interfaces:
Inspector
A read-only view of a Slime value that is stored in binary format.
-
Method Summary
Modifier and TypeMethodDescriptionvoidUse the visitor pattern to resolve the underlying type of this value.booleanasBool()the current value (for booleans); default: falsebyte[]asData()the current value (for data values); default: empty arraydoubleasDouble()the current value (for floating-point values); default: 0.0longasLong()the current value (for integers); default: 0asString()the current value (for string values); default: empty stringbyte[]asUtf8()the current value encoded into UTF-8 (for string values); default: empty arrayintchildren()Check how many entries or fields are contained in the current value.intentries()Check how many entries are contained in the current value.entry(int idx) Access an array entry.field(int sym) Access a field in an object by symbol id.Access a field in an object by symbol name.intfields()Check how many fields are contained in the current value.voidInvoke the given consumer with this value if it is validstatic Inspectorinspect(byte[] data) voidTraverse an array value, performing callbacks for each entry.voidTraverse an object value, performing callbacks for each field.voidTraverse an object value, performing callbacks for each field.type()return an enum describing value typebooleanvalid()check if this inspector is valid
-
Method Details
-
valid
public boolean valid()Description copied from interface:Inspectorcheck if this inspector is valid -
ifValid
Description copied from interface:InspectorInvoke the given consumer with this value if it is valid -
type
Description copied from interface:Inspectorreturn an enum describing value type -
children
public int children()Description copied from interface:InspectorCheck how many entries or fields are contained in the current value. Useful for arrays and objects; anything else always returns 0. -
entries
public int entries()Description copied from interface:InspectorCheck how many entries are contained in the current value. Useful for arrays; anything else always returns 0. -
fields
public int fields()Description copied from interface:InspectorCheck how many fields are contained in the current value. Useful for objects; anything else always returns 0. -
asBool
public boolean asBool()Description copied from interface:Inspectorthe current value (for booleans); default: false -
asLong
public long asLong()Description copied from interface:Inspectorthe current value (for integers); default: 0 -
asDouble
public double asDouble()Description copied from interface:Inspectorthe current value (for floating-point values); default: 0.0 -
asString
Description copied from interface:Inspectorthe current value (for string values); default: empty string -
asUtf8
public byte[] asUtf8()Description copied from interface:Inspectorthe current value encoded into UTF-8 (for string values); default: empty array -
asData
public byte[] asData()Description copied from interface:Inspectorthe current value (for data values); default: empty array -
accept
Description copied from interface:InspectorUse the visitor pattern to resolve the underlying type of this value. -
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. -
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. -
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. -
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 a field in an object by symbol id. If the current Inspector doesn't connect to an object value, or the object value does not contain a field with the given symbol id, the returned Inspector will be invalid. -
field
Description copied from interface:InspectorAccess a field in an object by symbol name. 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. -
inspect
-