public class Attribute
extends java.lang.Object
An attribute is made of a key and a value. The key must be a string up to 128 characters. The value can be any binary or typed data up to 63 KBytes.
Constructor and Description |
---|
Attribute(java.lang.String key,
boolean value)
Creates an attribute with a boolean value.
|
Attribute(java.lang.String key,
boolean value,
boolean searchable)
Creates an attribute with a boolean value.
|
Attribute(java.lang.String key,
java.nio.ByteBuffer value)
Creates an attribute with binary value.
|
Attribute(java.lang.String key,
java.nio.ByteBuffer value,
boolean searchable)
Creates an attribute with binary value.
|
Attribute(java.lang.String key,
float value)
Creates an attribute with an long value.
|
Attribute(java.lang.String key,
float value,
boolean searchable)
Creates an attribute with a float value.
|
Attribute(java.lang.String key,
int value)
Creates an attribute with an integer value.
|
Attribute(java.lang.String key,
int value,
boolean searchable)
Creates an attribute with an integer value.
|
Attribute(java.lang.String key,
long value)
Creates an attribute with an long value.
|
Attribute(java.lang.String key,
long value,
boolean searchable)
Creates an attribute with a long value.
|
Attribute(java.lang.String key,
java.lang.String value)
Creates an attribute with a string value.
|
Attribute(java.lang.String key,
java.lang.String value,
boolean searchable)
Creates an attribute with a string value.
|
Modifier and Type | Method and Description |
---|---|
static Attribute |
createTextAttribute(java.lang.String key,
java.lang.String value)
Creates a searchable textual attribute.
|
static Attribute |
createTextAttribute(java.lang.String key,
java.lang.String value,
boolean searchable)
Creates a searchable/non-searchable textual attribute.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getKey()
Returns this attribute key
|
java.lang.Object |
getValue()
Returns this attribute value wrapped in an object.
|
java.lang.Object |
getValue(java.lang.Object type)
Returns this attribute value based on a default value type.
|
int |
hashCode() |
void |
setSearchableInContentDB(boolean searchable)
Marks attribute as searchable/non-searchable in cluster's content DB.
|
public Attribute(java.lang.String key, java.nio.ByteBuffer value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- if true attribute is indexed in metadata db. This flag also enforces searchableInContentDB flagpublic Attribute(java.lang.String key, java.nio.ByteBuffer value)
key
- attribute keyvalue
- attribute valuepublic Attribute(java.lang.String key, java.lang.String value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- if true attribute is indexed in metadata db. This flag also enforces searchableInContentDB flagpublic Attribute(java.lang.String key, java.lang.String value)
key
- attribute keyvalue
- attribute valuepublic Attribute(java.lang.String key, boolean value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- searchable flagpublic Attribute(java.lang.String key, boolean value)
key
- attribute keyvalue
- attribute valuepublic Attribute(java.lang.String key, int value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- if true attribute is indexed in metadata db. This flag also enforces searchableInContentDB flagpublic Attribute(java.lang.String key, int value)
key
- attribute keyvalue
- attribute valuepublic Attribute(java.lang.String key, long value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- if true attribute is indexed in metadata db. This flag also enforces searchableInContentDB flagpublic Attribute(java.lang.String key, long value)
key
- attribute keyvalue
- attribute valuepublic Attribute(java.lang.String key, float value, boolean searchable)
key
- attribute keyvalue
- attribute valuesearchable
- if true attribute is indexed in metadata db. This flag also enforces searchableInContentDB flagpublic Attribute(java.lang.String key, float value)
key
- attribute keyvalue
- attribute valuepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static Attribute createTextAttribute(java.lang.String key, java.lang.String value)
key
- attribute's keyvalue
- text value of the attributepublic static Attribute createTextAttribute(java.lang.String key, java.lang.String value, boolean searchable)
key
- attribute's keyvalue
- text value of the attributepublic java.lang.String getKey()
public java.lang.Object getValue()
public java.lang.Object getValue(java.lang.Object type)
type
- default value typepublic void setSearchableInContentDB(boolean searchable)
searchable
argument passed to the constructor of Attribute
creation was true (default).searchable
- if true attribute will be indexed in content DB, otherwise non-searchable