Package org.eclipse.cdt.core.settings.model

## Interface ICStorageElement

All Known Implementing Classes:
  `XmlStorageElement`

    public interface ICStorageElement

This interface represents an generic element in a storage tree. These trees are rooted at `ICSettingsStorage` elements. This abstract storage mechanism is used, e.g. with the `ICProjectDescription` and `ICConfigurationDescription` for storing custom data in the settings file (.cproject) or in a database.

See Also:
  `ICSettingsStorage`, `ICProjectDescription`, `ICConfigurationDescription`
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `clear()` Erases all children, attributes and any value set on this ICStorageElement
`ICStorageElement` `createChild​(String name)` Create a child ICStorageElement with the given name.
`ICStorageElement` `createCopy()` Create a deep copy of the current ICStorageElement such that name, children, attributes and value are the same.
`boolean` `equals​(ICStorageElement other)` Tests whether this storage element is exactly equal to other To be equal all name, children attributes and value must be equal between the two ICStorageElements
`String` `getAttribute​(String name)` Return the String of attribute value for name.
`String[]` `getAttributeNames()` Returns a string array of attribute names
`ICStorageElement[]` `getChildren()` Returns an array of the ICStorageElement children of this ICStorageElement or an empty array if no children were found
`ICStorageElement[]` `getChildrenByName​(String name)` Returns the children ICStorageElements with name name
`String` `getName()` Returns the name of this ICStorageElement
`ICStorageElement` `getParent()` Return the parent IStorageElement or null if this ICStorageElement doesn't have a parent
`String` `getValue()` Returns the String value of this element or null if there is no String value set.
`boolean` `hasAttribute​(String name)` Return whether this ICStorageElement contains an attribute value for name
`boolean` `hasChildren()` Returns true if this storage element has child ICStorageElements
`ICStorageElement` `importChild​(ICStorageElement element)` Imports an existing ICStorageElemtn as a child of this ICStorageElement
`void` `removeAttribute​(String name)` Remove an attribute from this ICStorageElement
`void` `removeChild​(ICStorageElement el)` Removes the ICStorageElement from the set of child ICSotrageElements
`void` `setAttribute​(String name, String value)` Set an attribute on this ICStorageElement
`void` `setValue​(String value)` Sets a String value on the ICStorageElement

### Method Detail

#### getAttribute

    String getAttribute​(String name)

Return the String of attribute value for name. If attribute is not found (hasAttribute(name) is false) this method returns null

Parameters:
  `name` -
Returns:
  String value or null if hasAttribute is false

#### hasAttribute

    boolean hasAttribute​(String name)

Return whether this ICStorageElement contains an attribute value for name

Parameters:
  `name` -
Returns:
  boolean indicating existence of attribute with name name
Since:
  5.1

#### getAttributeNames

    String[] getAttributeNames()

Returns a string array of attribute names

#### getParent

    ICStorageElement getParent()

Return the parent IStorageElement or null if this ICStorageElement doesn't have a parent

Returns:
  ICStorageElement parent or null

#### setAttribute

    void setAttribute​(String name,
                      String value)

Set an attribute on this ICStorageElement

Parameters:
  `name` -
  `value` -

#### removeAttribute

    void removeAttribute​(String name)

Remove an attribute from this ICStorageElement

Parameters:
  `name` -

#### createChild

    ICStorageElement createChild​(String name)

Create a child ICStorageElement with the given name.

Parameters:
  `name` -
Returns:
  new ICStorageElement representing the child

#### getChildren

    ICStorageElement[] getChildren()

Returns an array of the ICStorageElement children of this ICStorageElement or an empty array if no children were found

Returns:
  ICStorageElement[] of children or empty array

#### getChildrenByName

    ICStorageElement[] getChildrenByName​(String name)

Returns the children ICStorageElements with name name

Parameters:
  `name` - String name of children to be returned
Returns:
  ICStorageElement[] of children may be the empty list if no children with name found
Since:
  5.1

#### hasChildren

    boolean hasChildren()

Returns true if this storage element has child ICStorageElements

Returns:
  boolean indicating whether this ICStorageElement has children
Since:
  5.1

#### clear

    void clear()

Erases all children, attributes and any value set on this ICStorageElement

#### getName

    String getName()

Returns the name of this ICStorageElement

#### removeChild

    void removeChild​(ICStorageElement el)

Removes the ICStorageElement from the set of child ICSotrageElements

Parameters:
  `el` -

#### getValue

    String getValue()

Returns the String value of this element or null if there is no String value set. NB a pure whitespace value is considered to be null

Returns:
  String or null

#### setValue

    void setValue​(String value)

Sets a String value on the ICStorageElement

Parameters:
  `value` -

#### importChild

    ICStorageElement importChild​(ICStorageElement element)
                          throws UnsupportedOperationException

Imports an existing ICStorageElemtn as a child of this ICStorageElement

Parameters:
  `element` -
Returns:
  ICStorageElement a handle on the newly imported ICStorageElement
Throws:
  `UnsupportedOperationException`

#### createCopy

    ICStorageElement createCopy()
                         throws UnsupportedOperationException,
                                org.eclipse.core.runtime.CoreException

Create a deep copy of the current ICStorageElement such that name, children, attributes and value are the same.
However this is implemented it should appear to the user that a deep copy of the elements within has occurred. [ Though the implementation may be copy-on-write if the underlying data structure is suitable. ]
getParent() of the clone should be equal to the original element.getParent(). However the clone() doesn't appear in the parent's getChildren() array.

Returns:
  ICStorageElement deep copy of this ICStorageElement
Throws:
  `UnsupportedOperationException`
  `org.eclipse.core.runtime.CoreException`
Since:
  5.1

#### equals

    boolean equals​(ICStorageElement other)

Tests whether this storage element is exactly equal to other To be equal all name, children attributes and value must be equal between the two ICStorageElements

Parameters:
  `other` -
Returns:
  boolean indicating equality
Since:
  5.1