public class InvocationRecord extends Object
InetAddress
) of the client that submitted the
Command and the timestamp of the Command submission.
This class also supports storing zero or more arbitrary mappings of key to value, where key is
a String and value is any Object. Convenience methods are provided that enable retrieving
type-specific data by its key. The data stored in an InvocationRecord
is CommandHandler-specific.
The lock()
method makes an instance of this class immutable. After an instance is locked,
calling the set(String, Object)
method will throw an AssertFailedException
.
Constructor and Description |
---|
InvocationRecord(Command command,
InetAddress clientHost)
Create a new instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Returns
true if this object contains a mapping for the specified key. |
InetAddress |
getClientHost() |
Command |
getCommand() |
Object |
getObject(String key)
Get the Object value associated with the specified key.
|
String |
getString(String key)
Get the String value associated with the specified key.
|
Date |
getTime() |
boolean |
isLocked()
Return true if this object has been locked, false otherwise.
|
Set |
keySet()
Returns a Set view of the keys for the data stored in this object.
|
void |
lock()
Lock this instance, making it immutable.
|
void |
set(String key,
Object value)
Store the value for the specified key.
|
String |
toString()
Return the String representation of this object
|
public InvocationRecord(Command command, InetAddress clientHost)
command
- - the CommandclientHost
- - the client hostpublic void lock()
set(String, Object)
method will throw an
AssertFailedException
.public boolean isLocked()
lock()
.public InetAddress getClientHost()
public Command getCommand()
public Date getTime()
public void set(String key, Object value)
AssertFailedException
if this object has been locked. See lock()
.key
- - the key; must not be nullvalue
- - the value to store for the specified keyAssertFailedException
- - if the key is null or this object has been locked.public boolean containsKey(String key)
true
if this object contains a mapping for the specified key.key
- - the key; must not be nulltrue
if there is a mapping for the keyAssertFailedException
- - if the key is nullpublic Set keySet()
public String getString(String key)
key
- - the key; must not be nullClassCastException
- - if the object for the specified key is not a StringAssertFailedException
- - if the key is nullpublic Object getObject(String key)
key
- - the key; must not be nullAssertFailedException
- - if the key is nullpublic String toString()
toString
in class Object
Object.toString()
Copyright © 2016. All rights reserved.