org.jboss.cache.commands.write
Class PutKeyValueCommand
java.lang.Object
org.jboss.cache.commands.read.AbstractDataCommand
org.jboss.cache.commands.write.AbstractVersionedDataCommand
org.jboss.cache.commands.write.PutKeyValueCommand
- All Implemented Interfaces:
- Cloneable, DataCommand, ReplicableCommand, ReversibleCommand, VersionedDataCommand, VisitableCommand
public class PutKeyValueCommand
- extends AbstractVersionedDataCommand
Implements functionality defined by Cache.put(org.jboss.cache.Fqn, Object, Object)
. Also implements
Cache.putForExternalRead(org.jboss.cache.Fqn, Object, Object)
if isPutForExternalRead()
is true.
- Since:
- 2.2
- Author:
- Mircea.Markus@jboss.com
METHOD_ID
public static final int METHOD_ID
- See Also:
- Constant Field Values
VERSIONED_METHOD_ID
public static final int VERSIONED_METHOD_ID
- See Also:
- Constant Field Values
PUT_FOR_EXT_READ_METHOD_ID
public static final int PUT_FOR_EXT_READ_METHOD_ID
- See Also:
- Constant Field Values
PUT_FOR_EXT_READ_VERSIONED_METHOD_ID
public static final int PUT_FOR_EXT_READ_VERSIONED_METHOD_ID
- See Also:
- Constant Field Values
PutKeyValueCommand
public PutKeyValueCommand(GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value,
boolean createUndoOps,
boolean putForExternalRead)
PutKeyValueCommand
public PutKeyValueCommand()
perform
public Object perform(InvocationContext ctx)
- Puts the specified key and value into the data map in the node referenced by the specified Fqn.
- Parameters:
ctx
- invocation context
- Returns:
- the value being overwritten, if any, otherwise a null.
rollback
public void rollback()
- Description copied from interface:
ReversibleCommand
- Reverses a command that has already been invoked.
Important: this method will be invoked at the end of interceptors chain. It should never be called directly from
a custom interceptor.
acceptVisitor
public Object acceptVisitor(InvocationContext ctx,
Visitor visitor)
throws Throwable
- Description copied from interface:
VisitableCommand
- Accept a visitor, and return the result of accepting this visitor.
- Parameters:
ctx
- invocation contextvisitor
- visitor to accept
- Returns:
- arbitrary return value
- Throws:
Throwable
- in the event of problems
isPutForExternalRead
public boolean isPutForExternalRead()
getKey
public Object getKey()
getValue
public Object getValue()
isCreateUndoOps
public boolean isCreateUndoOps()
setKey
public void setKey(Object key)
setValue
public void setValue(Object value)
getCommandId
public int getCommandId()
- Description copied from interface:
ReplicableCommand
- Used by marshallers to convert this command into an id for streaming.
- Returns:
- the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.
getParameters
public Object[] getParameters()
- Description copied from class:
AbstractDataCommand
- Basic versions of these methods
- Specified by:
getParameters
in interface ReplicableCommand
- Overrides:
getParameters
in class AbstractVersionedDataCommand
- Returns:
- an object array of arguments, compatible with pre-2.2.0 MethodCall args.
setParameters
public void setParameters(int commandId,
Object[] args)
- Description copied from class:
AbstractDataCommand
- Basic versions of these methods
- Specified by:
setParameters
in interface ReplicableCommand
- Overrides:
setParameters
in class AbstractVersionedDataCommand
- Parameters:
commandId
- command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as PutKeyValueCommand
.args
- object array of args
equals
public boolean equals(Object o)
- Overrides:
equals
in class AbstractVersionedDataCommand
hashCode
public int hashCode()
- Overrides:
hashCode
in class AbstractVersionedDataCommand
isVersionedId
protected boolean isVersionedId(int commandId)
- Specified by:
isVersionedId
in class AbstractVersionedDataCommand
toString
public String toString()
- Overrides:
toString
in class AbstractDataCommand
Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.