Class PropertySet

All Implemented Interfaces:
Cloneable, Iterable<Resource>, ResourceCollection

public class PropertySet extends DataType implements ResourceCollection
A set of properties.
Ant 1.6
  • Constructor Details

    • PropertySet

      public PropertySet()
  • Method Details

    • appendName

      public void appendName(String name)
      Allow properties of a particular name in the set.
      name - the property name to allow.
    • appendRegex

      public void appendRegex(String regex)
      Allow properties whose names match a regex in the set.
      regex - the regular expression to use.
    • appendPrefix

      public void appendPrefix(String prefix)
      Allow properties whose names start with a prefix in the set.
      prefix - the prefix to use.
    • appendBuiltin

      public void appendBuiltin(PropertySet.BuiltinPropertySetName b)
      Allow builtin (all, system or commandline) properties in the set.
      b - the type of builtin properties.
    • setMapper

      public void setMapper(String type, String from, String to)
      Set a mapper to change property names.
      type - mapper type.
      from - source pattern.
      to - output pattern.
    • addPropertyref

      public void addPropertyref(PropertySet.PropertyRef ref)
      Add a property reference (nested element) to the references to be used.
      ref - a property reference.
    • addPropertyset

      public void addPropertyset(PropertySet ref)
      Add another property set to this set.
      ref - another property set.
    • createMapper

      public Mapper createMapper()
      Create a mapper to map the property names.
      a mapper to be configured.
    • add

      public void add(FileNameMapper fileNameMapper)
      Add a nested FileNameMapper.
      fileNameMapper - the mapper to add.
      Ant 1.6.3
    • setDynamic

      public void setDynamic(boolean dynamic)
      Set whether to reevaluate the set every time the set is used. Default is true.
      dynamic - if true, reevaluate the property set each time the set is used. if false cache the property set the first time and use the cached set on subsequent occasions.
    • setNegate

      public void setNegate(boolean negate)
      Set whether to negate results. If "true", all properties not selected by nested elements will be returned. Default is "false".
      negate - if true, negate the selection criteria.
    • getDynamic

      public boolean getDynamic()
      Get the dynamic attribute.
      true if the property set is to be evaluated each time it is used.
    • getMapper

      public Mapper getMapper()
      Get the mapper attribute.
      the mapper attribute.
    • getProperties

      public Properties getProperties()
      This is the operation to get the existing or recalculated properties.
      the properties for this propertyset.
    • getRef

      protected PropertySet getRef()
      Performs the check for circular references and returns the referenced PropertySet.
      the referenced PropertySet.
    • setRefid

      public final void setRefid(Reference r)
      Sets the value of the refid attribute.
      setRefid in class DataType
      r - the reference this datatype should point to.
      BuildException - if another attribute was set, since refid and all other attributes are mutually exclusive.
    • assertNotReference

      protected final void assertNotReference()
      Ensures this data type is not a reference.

      Calling this method as the first line of every bean method of this data type (setXyz, addXyz, createXyz) ensure proper handling of the refid attribute.

      BuildException - if the refid attribute was already set, since refid and all other attributes are mutually exclusive.
    • toString

      public String toString()
      A debug toString. This gets a comma separated list of key=value pairs for the properties in the set. The output order is sorted according to the keys' natural order.
      toString in class DataType
      a string rep of this object.
    • iterator

      public Iterator<Resource> iterator()
      Fulfill the ResourceCollection interface.
      Specified by:
      iterator in interface Iterable<Resource>
      an Iterator of Resources.
      Ant 1.7
    • size

      public int size()
      Fulfill the ResourceCollection contract.
      Specified by:
      size in interface ResourceCollection
      the size of this ResourceCollection.
    • isFilesystemOnly

      public boolean isFilesystemOnly()
      Fulfill the ResourceCollection contract.
      Specified by:
      isFilesystemOnly in interface ResourceCollection
      whether this is a filesystem-only resource collection.
    • dieOnCircularReference

      protected void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException
      Description copied from class: DataType
      Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).

      If one is included, throw a BuildException created by circularReference.

      This implementation is appropriate only for a DataType that cannot hold other DataTypes as children.

      The general contract of this method is that it shouldn't do anything if DataType.checked is true and set it to true on exit.

      dieOnCircularReference in class DataType
      stk - the stack of references to check.
      p - the project to use to dereference the references.
      BuildException - on error.