public class GridMetadataAwareAdapter extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GridMetadataAwareAdapter.EntryKey
Enum stored predefined keys.
|
| Constructor and Description |
|---|
GridMetadataAwareAdapter() |
| Modifier and Type | Method and Description |
|---|---|
<V> V |
addMeta(int key,
V val)
Adds a new metadata.
|
<V> V |
addMetaIfAbsent(int key,
@Nullable Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
addMetaIfAbsent(int key,
V val)
Adds given metadata value only if it was absent.
|
<V> Object[] |
allMeta()
Gets all metadata in this entry.
|
Object |
clone() |
void |
copyMeta(GridMetadataAwareAdapter from)
Copies all metadata from another instance.
|
void |
copyMeta(Object[] data)
Copies all metadata from given map.
|
boolean |
hasMeta(int key)
Tests whether or not given metadata is set.
|
<V> boolean |
hasMeta(int key,
V val)
Tests whether or not given metadata is set.
|
<V> V |
meta(int key)
Gets metadata by name.
|
<V> V |
putMetaIfAbsent(int key,
V val)
Adds given metadata value only if it was absent.
|
protected void |
readExternalMeta(ObjectInput in)
Convenience way for super-classes which implement
Externalizable to serialize metadata. |
void |
removeAllMeta()
Removes all meta.
|
<V> V |
removeMeta(int key)
Removes metadata by key.
|
<V> boolean |
removeMeta(int key,
V val)
Removes metadata only if its current value is equal to
val passed in. |
<V> boolean |
replaceMeta(int key,
V curVal,
V newVal)
Replaces given metadata with new
newVal value only if its current value is equal to curVal. |
protected void |
writeExternalMeta(ObjectOutput out)
Convenience way for super-classes which implement
Externalizable to serialize metadata. |
public void copyMeta(GridMetadataAwareAdapter from)
from - Metadata aware instance to copy metadata from.public void copyMeta(Object[] data)
data - Map to copy metadata from.@Nullable
public <V> V addMeta(int key,
V val)
V - Type of the value.key - Metadata key.val - Metadata value.null if there was none.@Nullable public <V> V meta(int key)
V - Type of the value.key - Metadata key.null.@Nullable public <V> V removeMeta(int key)
V - Type of the value.key - Name of the metadata to remove.null.public <V> boolean removeMeta(int key,
V val)
val passed in.V - Value type.key - Name of metadata attribute.val - Value to compare.True if value was removed, false otherwise.public <V> Object[] allMeta()
V - Type of the value.public void removeAllMeta()
public boolean hasMeta(int key)
key - key of the metadata to test.public <V> boolean hasMeta(int key,
V val)
key - Key of the metadata to test.@Nullable
public <V> V putMetaIfAbsent(int key,
V val)
V - Type of the value.key - Metadata key.val - Value to add if it's not attached already.null if new value was put, or current value if put didn't happen.public <V> V addMetaIfAbsent(int key,
V val)
V - Type of the value.key - Metadata key.val - Value to add if it's not attached already.@Nullable
public <V> V addMetaIfAbsent(int key,
@Nullable
@Nullable Callable<V> c)
V - Type of the value.key - Metadata key.c - Factory closure to produce value to add if it's not attached already. Not that unlike addMeta(int, Object) method the factory closure will not be called unless the value is required and therefore
value will only be created when it is actually needed. If null and metadata value is missing - null will be returned from this method.public <V> boolean replaceMeta(int key,
V curVal,
V newVal)
newVal value only if its current value is equal to curVal.
Otherwise, it is no-op.key - Key of the metadata.curVal - Current value to check.newVal - New value.true if replacement occurred, false otherwise.protected void writeExternalMeta(ObjectOutput out) throws IOException
Externalizable to serialize metadata. Super-classes
must call this method explicitly from within Externalizable.writeExternal(ObjectOutput) methods
implementation.out - Output to write to.IOException - If I/O error occurred.protected void readExternalMeta(ObjectInput in) throws IOException, ClassNotFoundException
Externalizable to serialize metadata. Super-classes
must call this method explicitly from within Externalizable.readExternal(ObjectInput) methods
implementation.in - Input to read from.IOException - If I/O error occurred.ClassNotFoundException - If some class could not be found.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.9.1 Release Date : December 9 2020