Package org.apache.tools.ant

## Class RuntimeConfigurable

- java.lang.Object
- - org.apache.tools.ant.RuntimeConfigurable

- All Implemented Interfaces:
    `java.io.Serializable`

      public class RuntimeConfigurable
      extends java.lang.Object
      implements java.io.Serializable

  Wrapper class that holds the attributes of an element, its children, and any text within it. It then takes care of configuring that element at runtime.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RuntimeConfigurable​(java.lang.Object proxy, java.lang.String elementTag)` | Sole constructor creating a wrapper for the specified object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addChild​(RuntimeConfigurable child)` | Adds a child element to the wrapped element.
    `void` | `addText​(char[] buf, int start, int count)` | Adds characters from #PCDATA areas to the wrapped element.
    `void` | `addText​(java.lang.String data)` | Adds characters from #PCDATA areas to the wrapped element.
    `void` | `applyPreSet​(RuntimeConfigurable r)` | Apply presets, attributes and text are set if not currently set.
    `java.util.Hashtable<java.lang.String,​java.lang.Object>` | `getAttributeMap()` | Return the attribute map.
    `org.xml.sax.AttributeList` | `getAttributes()` | Deprecated. Deprecated since Ant 1.6 in favor of `getAttributeMap()`.
    `java.util.Enumeration<RuntimeConfigurable>` | `getChildren()` | Returns an enumeration of all child wrappers.
    `java.lang.String` | `getElementTag()` | Returns the tag name of the wrapped element.
    `java.lang.String` | `getId()` | Returns the id for this element.
    `java.lang.String` | `getPolyType()` | Get the polymorphic type for this element.
    `java.lang.Object` | `getProxy()` | Get the object for which this RuntimeConfigurable holds the configuration information.
    `java.lang.StringBuffer` | `getText()` | Get the text content of this element.
    `boolean` | `isEnabled​(UnknownElement owner)` | Check if an UE is enabled.
    `void` | `maybeConfigure​(Project p)` | Configures the wrapped element and all its children.
    `void` | `maybeConfigure​(Project p, boolean configureChildren)` | Configures the wrapped element.
    `void` | `reconfigure​(Project p)` | Reconfigure the element, even if it has already been configured.
    `void` | `removeAttribute​(java.lang.String name)` | Delete an attribute.
    `void` | `setAttribute​(java.lang.String name, java.lang.Object value)` | Set an attribute to a given value.
    `void` | `setAttribute​(java.lang.String name, java.lang.String value)` | Set an attribute to a given value.
    `void` | `setAttributes​(org.xml.sax.AttributeList attributes)` | Deprecated. since 1.6.x.
    `void` | `setElementTag​(java.lang.String elementTag)` | Set the element tag.
    `void` | `setPolyType​(java.lang.String polyType)` | Set the polymorphic type for this element.
    `void` | `setProxy​(java.lang.Object proxy)` | Sets the element to configure.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RuntimeConfigurable

          public RuntimeConfigurable​(java.lang.Object proxy,
                                     java.lang.String elementTag)

      Sole constructor creating a wrapper for the specified object.
      Parameters:
        `proxy` - The element to configure. Must not be `null`.
        `elementTag` - The tag name generating this element.

  - ### Method Detail

    - #### setProxy

          public void setProxy​(java.lang.Object proxy)

      Sets the element to configure.
      Parameters:
        `proxy` - The element to configure. Must not be `null`.

    - #### isEnabled

          public boolean isEnabled​(UnknownElement owner)

      Check if an UE is enabled. This looks tru the attributes and checks if there are any Ant attributes, and if so, the method calls the isEnabled() method on them.
      Parameters:
        `owner` - the UE that owns this RC.
      Returns:
        true if enabled, false if any of the ant attributes return false.
      Since:
        1.9.1

    - #### getProxy

          public java.lang.Object getProxy()

      Get the object for which this RuntimeConfigurable holds the configuration information.
      Returns:
        the object whose configure is held by this instance.

    - #### getId

          public java.lang.String getId()

      Returns the id for this element.
      Returns:
        the id.

    - #### getPolyType

          public java.lang.String getPolyType()

      Get the polymorphic type for this element.
      Returns:
        the ant component type name, null if not set.

    - #### setPolyType

          public void setPolyType​(java.lang.String polyType)

      Set the polymorphic type for this element.
      Parameters:
        `polyType` - the ant component type name, null if not set.

    - #### setAttributes

          @Deprecated
          public void setAttributes​(org.xml.sax.AttributeList attributes)

      Deprecated.
      since 1.6.x.
      Sets the attributes for the wrapped element.
      Parameters:
        `attributes` - List of attributes defined in the XML for this element. May be `null`.

    - #### setAttribute

          public void setAttribute​(java.lang.String name,
                                   java.lang.String value)

      Set an attribute to a given value.
      Parameters:
        `name` - the name of the attribute.
        `value` - the attribute's value.

    - #### setAttribute

          public void setAttribute​(java.lang.String name,
                                   java.lang.Object value)

      Set an attribute to a given value.
      Parameters:
        `name` - the name of the attribute.
        `value` - the attribute's value.
      Since:
        1.9

    - #### removeAttribute

          public void removeAttribute​(java.lang.String name)

      Delete an attribute. Not for the faint of heart.
      Parameters:
        `name` - the name of the attribute to be removed.

    - #### getAttributeMap

          public java.util.Hashtable<java.lang.String,​java.lang.Object> getAttributeMap()

      Return the attribute map.
      Returns:
        Attribute name to attribute value map.
      Since:
        Ant 1.6

    - #### getAttributes

          @Deprecated
          public org.xml.sax.AttributeList getAttributes()

      Deprecated.
      Deprecated since Ant 1.6 in favor of `getAttributeMap()`.
      Returns the list of attributes for the wrapped element.
      Returns:
        An AttributeList representing the attributes defined in the XML for this element. May be `null`.

    - #### addChild

          public void addChild​(RuntimeConfigurable child)

      Adds a child element to the wrapped element.
      Parameters:
        `child` - The child element wrapper to add to this one. Must not be `null`.

    - #### getChildren

          public java.util.Enumeration<RuntimeConfigurable> getChildren()

      Returns an enumeration of all child wrappers.
      Returns:
        an enumeration of the child wrappers.
      Since:
        Ant 1.6

    - #### addText

          public void addText​(java.lang.String data)

      Adds characters from #PCDATA areas to the wrapped element.
      Parameters:
        `data` - Text to add to the wrapped element. Should not be `null`.

    - #### addText

          public void addText​(char[] buf,
                              int start,
                              int count)

      Adds characters from #PCDATA areas to the wrapped element.
      Parameters:
        `buf` - A character array of the text within the element. Must not be `null`.
        `start` - The start element in the array.
        `count` - The number of characters to read from the array.

    - #### getText

          public java.lang.StringBuffer getText()

      Get the text content of this element. Various text chunks are concatenated, there is no way (currently) of keeping track of multiple fragments.
      Returns:
        the text content of this element.
      Since:
        Ant 1.6

    - #### setElementTag

          public void setElementTag​(java.lang.String elementTag)

      Set the element tag.
      Parameters:
        `elementTag` - The tag name generating this element.

    - #### getElementTag

          public java.lang.String getElementTag()

      Returns the tag name of the wrapped element.
      Returns:
        The tag name of the wrapped element. This is unlikely to be `null`, but may be.

    - #### maybeConfigure

          public void maybeConfigure​(Project p)
                              throws BuildException

      Configures the wrapped element and all its children. The attributes and text for the wrapped element are configured, and then each child is configured and added. Each time the wrapper is configured, the attributes and text for it are reset.

      If the element has an `id` attribute, a reference is added to the project as well.

      Parameters:
        `p` - The project containing the wrapped element. Must not be `null`.
      Throws:
        `BuildException` - if the configuration fails, for instance due to invalid attributes or children, or text being added to an element which doesn't accept it.

    - #### maybeConfigure

          public void maybeConfigure​(Project p,
                                     boolean configureChildren)
                              throws BuildException

      Configures the wrapped element. The attributes and text for the wrapped element are configured. Each time the wrapper is configured, the attributes and text for it are reset.

      If the element has an `id` attribute, a reference is added to the project as well.

      Parameters:
        `p` - The project containing the wrapped element. Must not be `null`.
        `configureChildren` - ignored.
      Throws:
        `BuildException` - if the configuration fails, for instance due to invalid attributes, or text being added to an element which doesn't accept it.

    - #### reconfigure

          public void reconfigure​(Project p)

      Reconfigure the element, even if it has already been configured.
      Parameters:
        `p` - the project instance for this configuration.

    - #### applyPreSet

          public void applyPreSet​(RuntimeConfigurable r)

      Apply presets, attributes and text are set if not currently set. Nested elements are prepended.
      Parameters:
        `r` - a `RuntimeConfigurable` value.