## com.baidubce.services.moladb.model
Class AttributeValue

    java.lang.Object
      com.baidubce.services.moladb.model.AttributeValue

    public class AttributeValue

extends Object

Represents the value for an attribute.

Field Summary
`static String` `ATTRIBUTE_TYPE_BINARY`
`static String` `ATTRIBUTE_TYPE_NUMBER`
`static String` `ATTRIBUTE_TYPE_STRING`

Constructor Summary
`AttributeValue()` Constructs a new AttributeValue object.
`AttributeValue(byte[] buffer)` Constructs a new AttributeValue object and init the value type as Binary
`AttributeValue(double d)` Constructs a new AttributeValue object and init the value type as Number
`AttributeValue(long n)` Constructs a new AttributeValue object and init the value type as Number
`AttributeValue(String s)` Constructs a new AttributeValue object and init the value type as String

Method Summary
`String` `getAttributeType()` The method return the attribute value type.
`String` `getAttributeValue()` The method return the attribute value.
`byte[]` `getB()` The method return the attribute value in byte array.
`double` `getDouble()` The method return the attribute value in Double.
`long` `getLong()` The method return the attribute value in Long.
`String` `getN()` The method return the attribute value in String.
`String` `getS()` The method return the attribute value in String.
`void` `setB(byte[] buffer)` The method set value type as binary and set the value with input parameter.
`void` `setN(double n)` The method set value type as number and set the value with input parameter.
`void` `setN(long n)` The method set value type as number and set the value with input parameter.
`void` `setN(String n)` The method set value type as number and set the value with input parameter.
`void` `setS(String s)` The method set value type as String and set the value with input parameter.
`void` `setValue(String type, String value)` The method set value type and value with input parameter.
`protected Map<String,String>` `toJsonObj()`
`String` `toString()` Return a string representation of the object.
`AttributeValue` `withB(byte[] buffer)` The method set value type as binary and set the value with input parameter.
`AttributeValue` `withN(double n)` The method set value type as number and set the value with input parameter.
`AttributeValue` `withN(long n)` The method set value type as number and set the value with input parameter.
`AttributeValue` `withN(String n)` The method set value type as number and set the value with input parameter.
`AttributeValue` `withS(String s)` The method set value type as String and set the value with input parameter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ATTRIBUTE_TYPE_NUMBER

    public static final String ATTRIBUTE_TYPE_NUMBER

See Also:
  Constant Field Values

### ATTRIBUTE_TYPE_STRING

    public static final String ATTRIBUTE_TYPE_STRING

See Also:
  Constant Field Values

### ATTRIBUTE_TYPE_BINARY

    public static final String ATTRIBUTE_TYPE_BINARY

See Also:
  Constant Field Values

Constructor Detail

### AttributeValue

    public AttributeValue()

  Constructs a new AttributeValue object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

### AttributeValue

    public AttributeValue(String s)

  Constructs a new AttributeValue object and init the value type as String

  Parameters:
    `s` - The initial value of AttributeValue

### AttributeValue

    public AttributeValue(double d)

  Constructs a new AttributeValue object and init the value type as Number

  Parameters:
    `d` - The initial value of AttributeValue

### AttributeValue

    public AttributeValue(long n)

  Constructs a new AttributeValue object and init the value type as Number

  Parameters:
    `n` - The initial value of AttributeValue

### AttributeValue

    public AttributeValue(byte[] buffer)

  Constructs a new AttributeValue object and init the value type as Binary

  Parameters:
    `buffer` - The input byte buffer for AttributeValue

Method Detail

### getB

    public byte[] getB()

  The method return the attribute value in byte array. Note: This method will decode the attribute value with base64 first.

  Returns:
    Attribute value in byte array.

### withB

    public AttributeValue withB(byte[] buffer)

  The method set value type as binary and set the value with input parameter. Input byte array will be encoded with base64. a reference to this object so that method calls can be chained together.

  Parameters:
    `buffer` - The value to be set.
  Returns:
    A reference to this object so that method calls can be chained together

### setB

    public void setB(byte[] buffer)

  The method set value type as binary and set the value with input parameter. Note: this method will encode the byte array with base64 first.

  Parameters:
    `buffer` - The value to be set.

### getN

    public String getN()

  The method return the attribute value in String.

  Returns:
    Attribute value in String.

### getLong

    public long getLong()

  The method return the attribute value in Long.

  Returns:
    Attribute value in long.

### getDouble

    public double getDouble()

  The method return the attribute value in Double.

  Returns:
    Attribute value in double.

### withN

    public AttributeValue withN(String n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.
  Returns:
    A reference to this object so that method calls can be chained together

### withN

    public AttributeValue withN(long n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.
  Returns:
    A reference to this object so that method calls can be chained together

### withN

    public AttributeValue withN(double n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.
  Returns:
    A reference to this object so that method calls can be chained together

### setN

    public void setN(String n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.

### setN

    public void setN(long n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.

### setN

    public void setN(double n)

  The method set value type as number and set the value with input parameter.

  Parameters:
    `n` - The value to be set.

### getS

    public String getS()

  The method return the attribute value in String.

  Returns:
    The attribute value in String.

### withS

    public AttributeValue withS(String s)

  The method set value type as String and set the value with input parameter.

  Parameters:
    `s` - The value to be set.
  Returns:
    A reference to this object so that method calls can be chained together

### setS

    public void setS(String s)

  The method set value type as String and set the value with input parameter.

  Parameters:
    `s` - The value to be set.

### getAttributeType

    public String getAttributeType()

  The method return the attribute value type.

  Returns:
    Attribute value type.

### getAttributeValue

    public String getAttributeValue()

  The method return the attribute value.

  Returns:
    Attribute value type.

### toString

    public String toString()

  Return a string representation of the object.

  Overrides:
    `toString` in class `Object`
  Returns:
    A string representation of the object.

### setValue

    public void setValue(String type,
                         String value)

  The method set value type and value with input parameter. If type is "B" (binary), the corresponding value MUST be encoded with base64.

  Parameters:
    `type` - The attribute type to be set.
    `value` - The value to be set.

### toJsonObj

    protected Map<String,String> toJsonObj()

Copyright © 2016. All rights reserved.