Class Value

java.lang.Object
com.aerospike.client.Value
Direct Known Subclasses:
Value.BooleanValue, Value.BoolIntValue, Value.ByteSegmentValue, Value.BytesValue, Value.ByteValue, Value.DoubleValue, Value.FloatValue, Value.GeoJSONValue, Value.HLLValue, Value.InfinityValue, Value.IntegerValue, Value.ListValue, Value.LongValue, Value.MapValue, Value.NullValue, Value.ShortValue, Value.SortedMapValue, Value.StringValue, Value.ValueArray, Value.WildcardValue

public abstract class Value extends Object
Polymorphic value classes used to efficiently serialize objects into the wire protocol.
  • Field Details

    • UseBoolBin

      public static boolean UseBoolBin
      Should client send boolean particle type for a boolean bin. If false, an integer particle type (1 or 0) is sent instead. Must be false for server versions less than 5.6 which do not support boolean bins. Can set to true for server 5.6+.
    • ReturnMapForKeyValue

      public static boolean ReturnMapForKeyValue
      Should the client return a map when MapReturnType.KEY_VALUE is specified in a map read operation and the server returns a list of key/value pairs.
    • NULL

      public static final Value NULL
      Null value.
    • INFINITY

      public static final Value INFINITY
      Infinity value to be used in CDT range comparisons only.
    • WILDCARD

      public static final Value WILDCARD
      Wildcard value to be used in CDT range comparisons only.
  • Constructor Details

    • Value

      public Value()
  • Method Details

    • get

      public static Value get(String value)
      Get string or null value instance.
    • get

      public static Value get(byte[] value)
      Get byte array or null value instance.
    • get

      public static Value get(byte[] value, int type)
      Get byte array with type or null value instance.
    • get

      public static Value get(byte[] value, int offset, int length)
      Get byte segment or null value instance.
    • get

      public static Value get(ByteBuffer bb)
      Get byte segment or null value instance.
    • get

      public static Value get(byte value)
      Get byte value instance.
    • get

      public static Value get(short value)
      Get short value instance.
    • get

      public static Value get(int value)
      Get integer value instance.
    • get

      public static Value get(long value)
      Get long value instance.
    • get

      public static Value get(double value)
      Get double value instance.
    • get

      public static Value get(float value)
      Get float value instance.
    • get

      public static Value get(boolean value)
      Get boolean value instance.
    • get

      public static Value get(Enum<?> value)
      Get enum value string instance.
    • get

      public static Value get(UUID value)
      Get UUID value string instance.
    • get

      public static Value get(List<?> value)
      Get list or null value instance.
    • get

      public static Value get(Map<?,?> value)
      Get map or null value instance.
    • get

      public static Value get(SortedMap<?,?> value)
      Get sorted map or null value instance.
    • get

      @Deprecated public static Value get(Map<?,?> value, MapOrder order)
      Deprecated.
      This method is deprecated. Use get(Map) if the map is unsorted (like HashMap). Use get(SortedMap) if the map is sorted (like TreeMap).

      Get map or null value instance.

    • get

      public static Value get(List<? extends Map.Entry<?,?>> value, MapOrder mapOrder)
      Get sorted map or null value instance.
    • get

      public static Value get(Value[] value)
      Get value array instance.
    • getAsGeoJSON

      public static Value getAsGeoJSON(String value)
      Get GeoJSON or null value instance.
    • getAsHLL

      public static Value getAsHLL(byte[] value)
      Get HyperLogLog or null value instance.
    • getAsNull

      public static Value getAsNull()
      Get null value instance.
    • get

      public static Value get(Object value)
      Determine value given generic object. This is the slowest of the Value get() methods. Useful when copying records from one cluster to another.
    • getFromRecordObject

      @Deprecated public static Value getFromRecordObject(Object value)
      Deprecated.

      Use get(Object) instead.

      Get value from Record object. Useful when copying records from one cluster to another.
    • estimateKeySize

      public int estimateKeySize()
      Calculate the approximate number of bytes necessary to serialize a key in the wire protocol. Size is not exact and may be greater than the actual bytes needed. Size must not be underestimated.
    • estimateSize

      public abstract int estimateSize() throws AerospikeException
      Calculate number of bytes necessary to serialize the value in the wire protocol.
      Throws:
      AerospikeException
    • write

      public abstract int write(byte[] buffer, int offset) throws AerospikeException
      Serialize the value in the wire protocol.
      Throws:
      AerospikeException
    • pack

      public abstract void pack(com.aerospike.client.util.Packer packer)
      Serialize the value using MessagePack.
    • validateKeyType

      public void validateKeyType() throws AerospikeException
      Validate if value type can be used as a key.
      Throws:
      AerospikeException - if type can't be used as a key.
    • getType

      public abstract int getType()
      Get wire protocol value type.
    • getObject

      public abstract Object getObject()
      Return original value as an Object.
    • getLuaValue

      public abstract org.luaj.vm2.LuaValue getLuaValue(com.aerospike.client.lua.LuaInstance instance)
      Return value as an Object.
    • toInteger

      public int toInteger()
      Return value as an integer.
    • toLong

      public long toLong()
      Return value as a long.