Class State

    • Constructor Detail

      • State

        public State()
        Constructor with default capacity.
      • State

        public State​(boolean threadSafe)
        Constructor with default capacity, optionally thread-safe.
        Parameters:
        threadSafe - if true, then a ConcurrentHashMap is used
      • State

        public State​(int size)
        Constructor for a given default size.
      • State

        public State​(int size,
                     boolean threadSafe)
        Constructor for a given default size, optionally thread-safe.
        Parameters:
        threadSafe - if true, then a ConcurrentHashMap is used
    • Method Detail

      • initialCapacity

        protected static int initialCapacity​(int size)
      • size

        public int size()
        Gets the number of elements.
      • isEmpty

        public boolean isEmpty()
        Checks if the state is empty.
      • get

        public Serializable get​(Object key)
        Gets a value for a key, or null if the key is not present.
      • remove

        public Serializable remove​(Object key)
        Removes the mapping for a key.
        Returns:
        the previous value associated with the key, or null if there was no mapping for the key
      • keySet

        public Set<String> keySet()
        Gets the key set. IT MUST NOT BE MODIFIED.
      • keyArray

        public String[] keyArray()
        Gets an array of keys.
      • containsKey

        public boolean containsKey​(Object key)
        Checks if there is a mapping for the given key.
      • toString

        public String toString()
        Overridden to display Calendars and arrays better, and truncate long strings and arrays.

        Also displays some keys first (ecm:id, ecm:name, ecm:primaryType)

        Overrides:
        toString in class Object
      • setSingle

        public void setSingle​(String name,
                              Object value)
        Description copied from interface: StateAccessor
        Sets a single value.
        Specified by:
        setSingle in interface StateAccessor
        Parameters:
        name - the name
        value - the value
      • setArray

        public void setArray​(String name,
                             Object[] value)
        Description copied from interface: StateAccessor
        Sets an array value.
        Specified by:
        setArray in interface StateAccessor
        Parameters:
        name - the name
        value - the value