Class Storage

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class Storage
    extends HtmlUnitScriptable
    The JavaScript object that represents a Storage.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.HashSet<java.lang.String> RESERVED_NAMES_  
      private java.util.Map<java.lang.String,​java.lang.String> store_  
      private static long STORE_SIZE_KIMIT  
      private long storeSize_  
      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      Storage()
      Public default constructor only for the prototype.
      Storage​(Window window, java.util.Map<java.lang.String,​java.lang.String> store)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all items.
      java.lang.Object get​(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start)
      Gets a named property from the object.
      java.lang.Object getItem​(java.lang.String key)
      Returns the value of the specified key.
      int getLength()
      Returns the length property.
      void jsConstructor()
      JavaScript constructor.
      java.lang.String key​(int index)
      Returns the key of the specified index.
      void put​(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start, java.lang.Object value)
      void removeItem​(java.lang.String key)
      Removes the specified key.
      void setItem​(java.lang.String key, java.lang.String data)
      Sets the item value.
      • Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RESERVED_NAMES_

        private static final java.util.HashSet<java.lang.String> RESERVED_NAMES_
      • store_

        private final java.util.Map<java.lang.String,​java.lang.String> store_
      • storeSize_

        private long storeSize_
    • Constructor Detail

      • Storage

        public Storage()
        Public default constructor only for the prototype.
      • Storage

        public Storage​(Window window,
                       java.util.Map<java.lang.String,​java.lang.String> store)
        Constructor.
        Parameters:
        window - the parent scope
        store - the storage itself
    • Method Detail

      • jsConstructor

        public void jsConstructor()
        JavaScript constructor.
      • put

        public void put​(java.lang.String name,
                        org.htmlunit.corejs.javascript.Scriptable start,
                        java.lang.Object value)
        Specified by:
        put in interface org.htmlunit.corejs.javascript.Scriptable
        Overrides:
        put in class HtmlUnitScriptable
      • get

        public java.lang.Object get​(java.lang.String name,
                                    org.htmlunit.corejs.javascript.Scriptable start)
        Gets a named property from the object. Normally HtmlUnit objects don't need to overwrite this method as properties are defined on the prototypes from the XML configuration. In some cases where "content" of object has priority compared to the properties consider using utility HtmlUnitScriptable.getWithPreemption(String).
        Specified by:
        get in interface org.htmlunit.corejs.javascript.Scriptable
        Overrides:
        get in class HtmlUnitScriptable
      • getLength

        public int getLength()
        Returns the length property.
        Returns:
        the length property
      • removeItem

        public void removeItem​(java.lang.String key)
        Removes the specified key.
        Parameters:
        key - the item key
      • key

        public java.lang.String key​(int index)
        Returns the key of the specified index.
        Parameters:
        index - the index
        Returns:
        the key
      • getItem

        public java.lang.Object getItem​(java.lang.String key)
        Returns the value of the specified key.
        Parameters:
        key - the item key
        Returns:
        the value
      • setItem

        public void setItem​(java.lang.String key,
                            java.lang.String data)
        Sets the item value.
        Parameters:
        key - the item key
        data - the value
      • clear

        public void clear()
        Clears all items.