Package org.glassfish.admin.rest.readers
Class InputObject
- java.lang.Object
-
- org.glassfish.admin.rest.provider.ProviderUtil
-
- org.glassfish.admin.rest.readers.InputObject
-
- Direct Known Subclasses:
XmlInputObject
public abstract class InputObject extends ProviderUtil
- Author:
- rajeshwar patil
-
-
Field Summary
Fields Modifier and Type Field Description protected Mapmap-
Fields inherited from class org.glassfish.admin.rest.provider.ProviderUtil
KEY_CHILD_RESOURCE, KEY_CHILD_RESOURCES, KEY_COMMAND, KEY_COMMANDS, KEY_ENTITY, KEY_METHODS
-
-
Constructor Summary
Constructors Constructor Description InputObject()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectget(String key)Get the value object associated with a key.booleangetBoolean(String key)Get the boolean value associated with a key.doublegetDouble(String key)Get the double value associated with a key.intgetInt(String key)Get the int value associated with a key.longgetLong(String key)Get the long value associated with a key.StringgetString(String key)Get the string associated with a key.booleanhas(String key)Determine if the InputObject contains a specific key.abstract MapinitializeMap()Get the map of key-value pairs represented by this object.booleanisNull(String key)Determine if the value associated with the key is null or if there is no value.Iteratorkeys()Get an enumeration of the keys of the InputObject.intlength()Get the number of keys stored in the InputObject.InputObjectput(String key, Object value)Put a key/value pair in this object, but only if the key and the value are both non-null, and only if there is not already a member with that name.InputObjectputMap(String key, Map value)Deprecated.replaced byputMap(java.util.Map)InputObjectputMap(Map value)Adds a map to the current objectstatic ObjectstringToValue(String s)Try to convert a string into a number, boolean, or null.-
Methods inherited from class org.glassfish.admin.rest.provider.ProviderUtil
getElementLink, getEndXmlElement, getHint, getHtmlForComponent, getHtmlHeader, getHtmlRepresentationForAttributes, getHtmlRespresentationsForCommand, getJsonForMethodMetaData, getJsonForMethodMetaData, getStartXmlElement, getStatistic, getStatistics, getStringMap, getXmlForMethodMetaData, jsonValue, quote, readAsString, slashToDash
-
-
-
-
Field Detail
-
map
protected Map map
-
-
Method Detail
-
initializeMap
public abstract Map initializeMap() throws InputException
Get the map of key-value pairs represented by this object.- Returns:
- The map of key-value pairs.
- Throws:
InputException
-
get
public Object get(String key) throws InputException
Get the value object associated with a key.- Parameters:
key- A key string.- Returns:
- The object associated with the key.
- Throws:
InputException- if the key is not found.
-
getBoolean
public boolean getBoolean(String key) throws InputException
Get the boolean value associated with a key.- Parameters:
key- A key string.- Returns:
- The boolean value associated with the key.
- Throws:
InputException- if the value is not a Boolean or the String "true" or "false".
-
getDouble
public double getDouble(String key) throws InputException
Get the double value associated with a key.- Parameters:
key- A key string.- Returns:
- The numeric value.
- Throws:
InputException- if the key is not found or if the value is not a Number object and cannot be converted to a number.
-
getInt
public int getInt(String key) throws InputException
Get the int value associated with a key. If the number value is too large for an int, it will be clipped.- Parameters:
key- A key string.- Returns:
- The integer value.
- Throws:
InputException- if the key is not found or if the value cannot be converted to an integer.
-
getLong
public long getLong(String key) throws InputException
Get the long value associated with a key. If the number value is too long for a long, it will be clipped.- Parameters:
key- A key string.- Returns:
- The long value.
- Throws:
InputException- if the key is not found or if the value cannot be converted to a long.
-
getString
public String getString(String key) throws InputException
Get the string associated with a key.- Parameters:
key- A key string.- Returns:
- A string which is the value.
- Throws:
InputException- if the key is not found.
-
has
public boolean has(String key)
Determine if the InputObject contains a specific key.- Parameters:
key- A key string.- Returns:
- true if the key exists in the InputObject.
-
isNull
public boolean isNull(String key)
Determine if the value associated with the key is null or if there is no value.- Parameters:
key- A key string.- Returns:
- true if there is no value associated with the key or if the value is null.
-
keys
public Iterator keys()
Get an enumeration of the keys of the InputObject.- Returns:
- An iterator of the keys.
-
length
public int length()
Get the number of keys stored in the InputObject.- Returns:
- The number of keys in the InputObject.
-
stringToValue
public static Object stringToValue(String s)
Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.- Parameters:
s- A String.- Returns:
- A simple JSON value.
-
put
public InputObject put(String key, Object value) throws InputException
Put a key/value pair in this object, but only if the key and the value are both non-null, and only if there is not already a member with that name. If the value is null, then the key will be removed from this object if it is present.- Parameters:
key-value- . It should be of one of these types: Boolean, Double, Integer, Long, String, or null.- Returns:
- this.
- Throws:
InputException- if the key is a duplicate
-
putMap
@Deprecated public InputObject putMap(String key, Map value)
Deprecated.replaced byputMap(java.util.Map)Adds all entries in a map to the current one- Parameters:
key- ignoredvalue- map to add- Returns:
- this
-
putMap
public InputObject putMap(Map value)
Adds a map to the current object- Parameters:
value- map to add- Returns:
- this
- See Also:
Map.putAll(java.util.Map)
-
-