Class HeapAttributeCollection

    • Constructor Detail

      • HeapAttributeCollection

        public HeapAttributeCollection()
    • Method Detail

      • addAttributes

        public void addAttributes​(Map<String,​Object> content)
        Description copied from interface: AttributeCollection
        Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.
        Parameters:
        content - is the content to add inside.
        See Also:
        AttributeCollection.setAttributes(Map)
      • setAttributes

        public void setAttributes​(Map<String,​Object> content)
        Description copied from interface: AttributeCollection
        Set the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:
        
         this.removeAllAttributes();
         this.addAttributes(content);
         
        Parameters:
        content - is the content.
        See Also:
        AttributeCollection.addAttributes(Map)
      • toMap

        public void toMap​(Map<String,​Object> mapToFill)
        Description copied from interface: AttributeProvider
        Fill the given map with the values stored in this attribute provider.
        Parameters:
        mapToFill - is the map to fill, never null.
      • getAttributeCount

        @Pure
        public int getAttributeCount()
        Description copied from interface: AttributeProvider
        Replies the count of attributes.
        Returns:
        the count of attributes.
      • hasAttribute

        @Pure
        public boolean hasAttribute​(String name)
        Description copied from interface: AttributeProvider
        Replies if the given attribute exists.
        Parameters:
        name - the name.
        Returns:
        true is an attribute with the given name exists, otherwise false
      • getAllAttributes

        @Pure
        public Collection<Attribute> getAllAttributes()
        Description copied from interface: AttributeProvider
        Replies all the attributes.
        Returns:
        the list of all attributes
      • getAllAttributesByType

        @Pure
        public Map<AttributeType,​Collection<Attribute>> getAllAttributesByType()
        Description copied from interface: AttributeProvider
        Replies all the attributes sorted by type.

        The keys of the returned hashtable are the types and the values are array of attributes (Vector).

        Returns:
        the attributes grouped by type.
      • getAllAttributeNames

        @Pure
        public Collection<String> getAllAttributeNames()
        Description copied from interface: AttributeProvider
        Replies all the attribute names. This function never load the attribute values even if they are not inside the storage layer.
        Returns:
        the list of all attribute names.
      • getAttribute

        @Pure
        public AttributeValue getAttribute​(String name)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Parameters:
        name - the name.
        Returns:
        the value or null
      • getAttribute

        @Pure
        public AttributeValue getAttribute​(String name,
                                           AttributeValue defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value or null
      • getAttributeObject

        @Pure
        public Attribute getAttributeObject​(String name)
        Description copied from interface: AttributeProvider
        Replies the attribute with the given name.
        Parameters:
        name - the name.
        Returns:
        the attribute or null
      • getStoredAttribute

        @Pure
        protected Attribute getStoredAttribute​(String name,
                                               AttributeType expectedType)
        Replies the attribute with the given name.
        Parameters:
        name - is the name of the attribute to retreive
        expectedType - is the expected type for the attribute.
        Returns:
        the value or null
      • getStoredAttributeValue

        @Pure
        protected AttributeValue getStoredAttributeValue​(String name,
                                                         AttributeType expectedType)
        Replies the attribute with the given name.
        Parameters:
        name - is the name of the attribute to retreive
        expectedType - is the expected type for the attribute.
        Returns:
        the value or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      boolean value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      int value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      long value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      float value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      double value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      String value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      UUID value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      URL value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      URI value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Date value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      InetAddress value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      InetSocketAddress value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Enum<?> value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Class<?> value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • removeAttribute

        public boolean removeAttribute​(String name)
        Description copied from interface: AttributeCollection
        Remove the given attribute.
        Parameters:
        name - is the name of the attribute to remove.
        Returns:
        true on success, otherwhise false
      • removeAllAttributes

        public boolean removeAllAttributes()
        Description copied from interface: AttributeCollection
        Remove all the attributes.
        Returns:
        false if something wrong appends
      • renameAttribute

        public boolean renameAttribute​(String oldname,
                                       String newname,
                                       boolean overwrite)
        Description copied from interface: AttributeCollection
        Rename the attribute .
        Parameters:
        oldname - is the name of the attribute to rename.
        newname - is the new name of the attribute.
        overwrite - must be true if the value of an existing attribute named by newname must be overwritten by the value of the attribute named oldname.
        Returns:
        false if something wrong appends
      • freeMemory

        public void freeMemory()
        Description copied from interface: AttributeProvider
        Clean the internal memory-storage structures if they exist.

        This function permits to limit the memory usage without removing the attribute value from a hard storage area (database, files...). The attribute which are freed by this method could be reloaded in memory with a call to a getting method.

      • flush

        public void flush()
        Description copied from interface: AttributeCollection
        Force this provider to synchronized the memory state of the attributes with a remote storage area.