Class CommandResponse
- java.lang.Object
-
- org.apache.zookeeper.server.admin.CommandResponse
-
public class CommandResponse extends java.lang.Object
A response from running aCommand
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_COMMAND
The key in the map returned bytoMap()
for the command name.static java.lang.String
KEY_ERROR
The key in the map returned bytoMap()
for the error string.
-
Constructor Summary
Constructors Constructor Description CommandResponse(java.lang.String command)
Creates a new response with no error string.CommandResponse(java.lang.String command, java.lang.String error)
Creates a new response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCommand()
Gets the command name.java.lang.String
getError()
Gets the error string (may be null).java.lang.Object
put(java.lang.String key, java.lang.Object value)
Adds a key/value pair to this response.void
putAll(java.util.Map<? extends java.lang.String,?> m)
Adds all key/value pairs in the given map to this response.java.util.Map<java.lang.String,java.lang.Object>
toMap()
Converts this response to a map.
-
-
-
Field Detail
-
KEY_COMMAND
public static final java.lang.String KEY_COMMAND
The key in the map returned bytoMap()
for the command name.- See Also:
- Constant Field Values
-
KEY_ERROR
public static final java.lang.String KEY_ERROR
The key in the map returned bytoMap()
for the error string.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommandResponse
public CommandResponse(java.lang.String command)
Creates a new response with no error string.- Parameters:
command
- command name
-
CommandResponse
public CommandResponse(java.lang.String command, java.lang.String error)
Creates a new response.- Parameters:
command
- command nameerror
- error string (may be null)
-
-
Method Detail
-
getCommand
public java.lang.String getCommand()
Gets the command name.- Returns:
- command name
-
getError
public java.lang.String getError()
Gets the error string (may be null).- Returns:
- error string
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)
Adds a key/value pair to this response.- Parameters:
key
- keyvalue
- value- Returns:
- prior value for key, or null if none
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,?> m)
Adds all key/value pairs in the given map to this response.- Parameters:
m
- map of key/value pairs
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()
Converts this response to a map. The returned map is mutable, and changes to it do not reflect back into this response.- Returns:
- map representation of response
-
-