public class GridMetadataAwareAdapter extends Object
| Constructor and Description |
|---|
GridMetadataAwareAdapter()
Default constructor.
|
GridMetadataAwareAdapter(Map<String,Object> data)
Creates adapter with predefined data.
|
| Modifier and Type | Method and Description |
|---|---|
<V> V |
addMeta(String name,
V val)
Adds a new metadata.
|
<V> V |
addMetaIfAbsent(String name,
Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
addMetaIfAbsent(String name,
V val)
Adds given metadata value only if it was absent.
|
<V> Map<String,V> |
allMeta()
Gets all metadata in this entry.
|
Object |
clone() |
void |
copyMeta(GridMetadataAwareAdapter from)
Copies all metadata from another instance.
|
void |
copyMeta(Map<String,?> data)
Copies all metadata from given map.
|
boolean |
hasMeta(String name)
Tests whether or not given metadata is set.
|
<V> boolean |
hasMeta(String name,
V val)
Tests whether or not given metadata is set.
|
<V> V |
meta(String name)
Gets metadata by name.
|
<V> V |
putMetaIfAbsent(String name,
Callable<V> c)
Adds given metadata value only if it was absent.
|
<V> V |
putMetaIfAbsent(String 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(String name)
Removes metadata by name.
|
<V> boolean |
removeMeta(String name,
V val)
Removes metadata only if its current value is equal to
val passed in. |
<V> boolean |
replaceMeta(String 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<String,?> data)
data - Map to copy metadata from.@Nullable public <V> V addMeta(String name, V val)
V - Type of the value.name - Metadata name.val - Metadata value.null if there was none.@Nullable public <V> V meta(String name)
V - Type of the value.name - Metadata name.null.@Nullable public <V> V removeMeta(String name)
V - Type of the value.name - Name of the metadata to remove.null.public <V> boolean removeMeta(String 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<String,V> allMeta()
V - Type of the value.public boolean hasMeta(String name)
name - Name of the metadata to test.public <V> boolean hasMeta(String name, V val)
name - Name of the metadata to test.@Nullable public <V> V putMetaIfAbsent(String 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.@Nullable public <V> V putMetaIfAbsent(String name, 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(String, 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.null if new value was put, or current value if put didn't happen.public <V> V addMetaIfAbsent(String name, V val)
putMetaIfAbsent(String, Callable), this method always returns
the latest value and never previous one.V - Type of the value.name - Metadata name.val - Value to add if it's not attached already.@Nullable public <V> V addMetaIfAbsent(String 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(String, 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(String 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-RC1 Release Date : February 17 2015