Class InputObject

    • Field Detail

      • map

        protected Map map
    • Constructor Detail

      • InputObject

        public InputObject()
    • 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