org.glassfish.admin.rest.readers
Class InputObject

java.lang.Object
  extended by org.glassfish.admin.rest.provider.ProviderUtil
      extended by org.glassfish.admin.rest.readers.InputObject
Direct Known Subclasses:
XmlInputObject

public abstract class InputObject
extends ProviderUtil

Author:
rajeshwar patil

Field Summary
protected  java.util.Map map
           
 
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
InputObject()
           
 
Method Summary
 java.lang.Object get(java.lang.String key)
          Get the value object associated with a key.
 boolean getBoolean(java.lang.String key)
          Get the boolean value associated with a key.
 double getDouble(java.lang.String key)
          Get the double value associated with a key.
 int getInt(java.lang.String key)
          Get the int value associated with a key.
 long getLong(java.lang.String key)
          Get the long value associated with a key.
 java.lang.String getString(java.lang.String key)
          Get the string associated with a key.
 boolean has(java.lang.String key)
          Determine if the InputObject contains a specific key.
abstract  java.util.Map initializeMap()
          Get the map of key-value pairs represented by this object.
 boolean isNull(java.lang.String key)
          Determine if the value associated with the key is null or if there is no value.
 java.util.Iterator keys()
          Get an enumeration of the keys of the InputObject.
 int length()
          Get the number of keys stored in the InputObject.
 InputObject put(java.lang.String key, java.lang.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.
 InputObject putMap(java.lang.String key, java.util.Map value)
           
static java.lang.Object stringToValue(java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.util.Map map
Constructor Detail

InputObject

public InputObject()
Method Detail

initializeMap

public abstract java.util.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 java.lang.Object get(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.String getString(java.lang.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(java.lang.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(java.lang.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 java.util.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 java.lang.Object stringToValue(java.lang.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(java.lang.String key,
                       java.lang.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

public InputObject putMap(java.lang.String key,
                          java.util.Map value)


Copyright © 2012 GlassFish Community. All Rights Reserved.