Class OptionsMap<K,​V>

    • Constructor Detail

      • OptionsMap

        public OptionsMap()
      • OptionsMap

        public OptionsMap​(int initialCapacity)
        Constructs an empty insertion-ordered OptionsMap instance with the specified initial capacity and a default load factor (0.75).
        Parameters:
        initialCapacity - the initial capacity
        Throws:
        IllegalArgumentException - if the initial capacity is negative
      • OptionsMap

        public OptionsMap​(String key,
                          Object value)
        Constructs an empty insertion-ordered OptionsMap instance with the specified a key with a value.
        See Also:
        HashMap.put(Object, Object)
      • OptionsMap

        public OptionsMap​(Object... pairs)
        Constructs an empty insertion-ordered OptionsMap instance with the specified pairs that contain keys with values.
        See Also:
        HashMap.put(Object, Object)
    • Method Detail

      • getParent

        public org.zkoss.json.JSONAware getParent()
        Returns the parent options either OptionsMap or OptionsList. If null, that means the option is root object.
      • add

        public OptionsMap<K,​V> add​(String key,
                                         Object value)
        Adds the key with the value into the map.
        Returns:
        the instance itself.
      • addNestedList

        public <E> OptionsList<E> addNestedList​(String key)
        Adds to create a nested options list with the given key.
        Returns:
        a nested options list
      • addNestedMap

        public OptionsMap<K,​V> addNestedMap​(String key)
        Adds to create a nested options map with the given key.
        Returns:
        a nested options map
      • toJSONString

        public String toJSONString()
        Specified by:
        toJSONString in interface org.zkoss.json.JSONAware