public class GridMetadataAwareAdapter extends Object
| Constructor and Description |
|---|
GridMetadataAwareAdapter()
Default constructor.
|
GridMetadataAwareAdapter(Map<UUID,Object> data)
Creates adapter with predefined data.
|
| Modifier and Type | Method and Description |
|---|---|
<V> V |
addMeta(UUID name,
V val)
Adds a new metadata.
|
<V> V |
addMetaIfAbsent(UUID name,
Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
addMetaIfAbsent(UUID name,
V val)
Adds given metadata value only if it was absent.
|
<V> Map<UUID,V> |
allMeta()
Gets all metadata in this entry.
|
Object |
clone() |
void |
copyMeta(GridMetadataAwareAdapter from)
Copies all metadata from another instance.
|
void |
copyMeta(Map<UUID,?> data)
Copies all metadata from given map.
|
boolean |
hasMeta(UUID name)
Tests whether or not given metadata is set.
|
<V> boolean |
hasMeta(UUID name,
V val)
Tests whether or not given metadata is set.
|
<V> V |
meta(UUID name)
Gets metadata by name.
|
<V> V |
putMetaIfAbsent(UUID name,
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. |
<V> V |
removeMeta(UUID name)
Removes metadata by name.
|
<V> boolean |
removeMeta(UUID name,
V val)
Removes metadata only if its current value is equal to
val passed in. |
<V> boolean |
replaceMeta(UUID name,
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(Map<UUID,?> data)
data - Map to copy metadata from.@Nullable public <V> V addMeta(UUID name, V val)
V - Type of the value.name - Metadata name.val - Metadata value.null if there was none.@Nullable public <V> V meta(UUID name)
V - Type of the value.name - Metadata name.null.@Nullable public <V> V removeMeta(UUID name)
V - Type of the value.name - Name of the metadata to remove.null.public <V> boolean removeMeta(UUID name, V val)
val passed in.V - Value type.name - Name of metadata attribute.val - Value to compare.True if value was removed, false otherwise.public <V> Map<UUID,V> allMeta()
V - Type of the value.public boolean hasMeta(UUID name)
name - Name of the metadata to test.public <V> boolean hasMeta(UUID name, V val)
name - Name of the metadata to test.@Nullable public <V> V putMetaIfAbsent(UUID name, V val)
V - Type of the value.name - Metadata name.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(UUID name, V val)
V - Type of the value.name - Metadata name.val - Value to add if it's not attached already.@Nullable public <V> V addMetaIfAbsent(UUID name, @Nullable Callable<V> c)
V - Type of the value.name - Metadata name.c - Factory closure to produce value to add if it's not attached already.
Not that unlike addMeta(UUID, 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(UUID name, V curVal, V newVal)
newVal value only if its current value
is equal to curVal. Otherwise, it is no-op.name - Name 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 Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015