Package org.codehaus.groovy.ant

# Class AntProjectPropertiesDelegate

java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<String,Object>
org.codehaus.groovy.ant.AntProjectPropertiesDelegate

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Map<String,Object>`

public class AntProjectPropertiesDelegate extends Hashtable<String,Object>
Live `Hashtable`-style view over an Ant project's immutable properties. Mutation requests are redirected to Ant where possible and otherwise rejected.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AntProjectPropertiesDelegate(Map<? extends String,?> t)`
  Creates a detached delegate initialized from the supplied map.
  `AntProjectPropertiesDelegate(org.apache.tools.ant.Project project)`
  Creates a delegate backed by the supplied Ant project.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  `Object`
  `clone()`
  Returns a shallow copy of the current project properties.
  `boolean`
  `contains(Object value)`
  Indicates whether the delegated property set contains the supplied value.
  `boolean`
  `containsKey(Object key)`
  Indicates whether the delegated property set contains the supplied key.
  `boolean`
  `containsValue(Object value)`
  Indicates whether the delegated property set contains the supplied value.
  `Enumeration<Object>`
  `elements()`
  Returns an enumeration over the current property values.
  `Set<Map.Entry<String,Object>>`
  `entrySet()`
  Returns the delegated entry-set view.
  `boolean`
  `equals(Object o)`
  Compares this delegate with another object using the delegated property map.
  `Object`
  `get(Object key)`
  Returns the current value of the supplied property.
  `int`
  `hashCode()`
  Returns the hash code of the current project properties.
  `boolean`
  `isEmpty()`
  Indicates whether the delegated property set is empty.
  `Enumeration<String>`
  `keys()`
  Returns an enumeration over the current property names.
  `Set<String>`
  `keySet()`
  Returns the delegated key-set view.
  `Object`
  `put(String key, Object value)`
  Stores the supplied property value through the owning Ant project.
  `void`
  `putAll(Map<? extends String,?> t)`
  Copies every supplied property into the owning Ant project.
  `Object`
  `remove(Object key)`
  `int`
  `size()`
  Returns the number of properties currently exposed by the project.
  `String`
  `toString()`
  Returns the string form of the delegated property map.
  `Collection<Object>`
  `values()`
  Returns the current property values.

  ### Methods inherited from class java.util.Hashtable

  `compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, rehash, remove, replace, replace, replaceAll`

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

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### AntProjectPropertiesDelegate

    public AntProjectPropertiesDelegate(org.apache.tools.ant.Project project)
    Creates a delegate backed by the supplied Ant project.
    Parameters:
      `project` - the project whose properties should be exposed

  - ### AntProjectPropertiesDelegate

    public AntProjectPropertiesDelegate(Map<? extends String,?> t)
    Creates a detached delegate initialized from the supplied map.
    Parameters:
      `t` - the initial property values

- ## Method Details

  - ### hashCode

    public int hashCode()
    Returns the hash code of the current project properties.
    Specified by:
      `hashCode` in interface `Map<String,Object>`
    Overrides:
      `hashCode` in class `Hashtable<String,Object>`
    Returns:
      the delegated hash code

  - ### size

    public int size()
    Returns the number of properties currently exposed by the project.
    Specified by:
      `size` in interface `Map<String,Object>`
    Overrides:
      `size` in class `Hashtable<String,Object>`
    Returns:
      the property count

  - ### clear

    public void clear()
    Specified by:
      `clear` in interface `Map<String,Object>`
    Overrides:
      `clear` in class `Hashtable<String,Object>`
    Throws:
      `UnsupportedOperationException` - is always thrown when this method is invoked. The Project properties are immutable.

  - ### isEmpty

    public boolean isEmpty()
    Indicates whether the delegated property set is empty.
    Specified by:
      `isEmpty` in interface `Map<String,Object>`
    Overrides:
      `isEmpty` in class `Hashtable<String,Object>`
    Returns:
      `true` if the project currently has no properties

  - ### clone

    public Object clone()
    Returns a shallow copy of the current project properties.
    Overrides:
      `clone` in class `Hashtable<String,Object>`
    Returns:
      a cloned property map

  - ### contains

    public boolean contains(Object value)
    Indicates whether the delegated property set contains the supplied value.
    Overrides:
      `contains` in class `Hashtable<String,Object>`
    Parameters:
      `value` - the value to look up
    Returns:
      `true` if the value is present

  - ### containsKey

    public boolean containsKey(Object key)
    Indicates whether the delegated property set contains the supplied key.
    Specified by:
      `containsKey` in interface `Map<String,Object>`
    Overrides:
      `containsKey` in class `Hashtable<String,Object>`
    Parameters:
      `key` - the property name to look up
    Returns:
      `true` if the key is present

  - ### containsValue

    public boolean containsValue(Object value)
    Indicates whether the delegated property set contains the supplied value.
    Specified by:
      `containsValue` in interface `Map<String,Object>`
    Overrides:
      `containsValue` in class `Hashtable<String,Object>`
    Parameters:
      `value` - the value to look up
    Returns:
      `true` if the value is present

  - ### equals

    public boolean equals(Object o)
    Compares this delegate with another object using the delegated property map.
    Specified by:
      `equals` in interface `Map<String,Object>`
    Overrides:
      `equals` in class `Hashtable<String,Object>`
    Parameters:
      `o` - the object to compare against
    Returns:
      `true` if both views are equal

  - ### toString

    public String toString()
    Returns the string form of the delegated property map.
    Overrides:
      `toString` in class `Hashtable<String,Object>`
    Returns:
      the property map as text

  - ### values

    public Collection<Object> values()
    Returns the current property values.
    Specified by:
      `values` in interface `Map<String,Object>`
    Overrides:
      `values` in class `Hashtable<String,Object>`
    Returns:
      a collection view over the values

  - ### elements

    public Enumeration<Object> elements()
    Returns an enumeration over the current property values.
    Overrides:
      `elements` in class `Hashtable<String,Object>`
    Returns:
      an enumeration across the delegated values

  - ### keys

    public Enumeration<String> keys()
    Returns an enumeration over the current property names.
    Overrides:
      `keys` in class `Hashtable<String,Object>`
    Returns:
      an enumeration across the delegated keys

  - ### putAll

    public void putAll(Map<? extends String,?> t)
    Copies every supplied property into the owning Ant project.
    Specified by:
      `putAll` in interface `Map<String,Object>`
    Overrides:
      `putAll` in class `Hashtable<String,Object>`
    Parameters:
      `t` - the properties to add

  - ### entrySet

    public Set<Map.Entry<String,Object>> entrySet()
    Returns the delegated entry-set view.
    Specified by:
      `entrySet` in interface `Map<String,Object>`
    Overrides:
      `entrySet` in class `Hashtable<String,Object>`
    Returns:
      a set view over the properties

  - ### keySet

    public Set<String> keySet()
    Returns the delegated key-set view.
    Specified by:
      `keySet` in interface `Map<String,Object>`
    Overrides:
      `keySet` in class `Hashtable<String,Object>`
    Returns:
      a set view over the property names

  - ### get

    public Object get(Object key)
    Returns the current value of the supplied property.
    Specified by:
      `get` in interface `Map<String,Object>`
    Overrides:
      `get` in class `Hashtable<String,Object>`
    Parameters:
      `key` - the property name to resolve
    Returns:
      the current value, or `null` if absent

  - ### remove

    public Object remove(Object key)
    Specified by:
      `remove` in interface `Map<String,Object>`
    Overrides:
      `remove` in class `Hashtable<String,Object>`
    Throws:
      `UnsupportedOperationException` - is always thrown when this method is invoked. The Project properties are immutable.

  - ### put

    public Object put(String key, Object value)
    Stores the supplied property value through the owning Ant project.
    Specified by:
      `put` in interface `Map<String,Object>`
    Overrides:
      `put` in class `Hashtable<String,Object>`
    Parameters:
      `key` - the property name
      `value` - the property value
    Returns:
      the previous value, or `null` if the property was not already present