Package org.apache.tools.ant.types
Class PropertySet
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.types.DataType
- 
- org.apache.tools.ant.types.PropertySet
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- java.lang.Iterable<Resource>,- ResourceCollection
 
 public class PropertySet extends DataType implements ResourceCollection A set of properties.- Since:
- Ant 1.6
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPropertySet.BuiltinPropertySetNameUsed for propertyref's builtin attribute.static classPropertySet.PropertyRefThis is a nested class containing a reference to some properties and optionally a source of properties.
 - 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description PropertySet()
 - 
Method SummaryModifier and Type Method Description voidadd(FileNameMapper fileNameMapper)Add a nested FileNameMapper.voidaddPropertyref(PropertySet.PropertyRef ref)Add a property reference (nested element) to the references to be used.voidaddPropertyset(PropertySet ref)Add another property set to this set.voidappendBuiltin(PropertySet.BuiltinPropertySetName b)Allow builtin (all, system or commandline) properties in the set.voidappendName(java.lang.String name)Allow properties of a particular name in the set.voidappendPrefix(java.lang.String prefix)Allow properties whose names start with a prefix in the set.voidappendRegex(java.lang.String regex)Allow properties whose names match a regex in the set.protected voidassertNotReference()Ensures this data type is not a reference.MappercreateMapper()Create a mapper to map the property names.protected voiddieOnCircularReference(java.util.Stack<java.lang.Object> stk, Project p)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).booleangetDynamic()Get the dynamic attribute.MappergetMapper()Get the mapper attribute.java.util.PropertiesgetProperties()This is the operation to get the existing or recalculated properties.protected PropertySetgetRef()Performs the check for circular references and returns the referenced PropertySet.booleanisFilesystemOnly()Fulfill the ResourceCollection contract.java.util.Iterator<Resource>iterator()Fulfill the ResourceCollection interface.voidsetDynamic(boolean dynamic)Set whether to reevaluate the set every time the set is used.voidsetMapper(java.lang.String type, java.lang.String from, java.lang.String to)Set a mapper to change property names.voidsetNegate(boolean negate)Set whether to negate results.voidsetRefid(Reference r)Sets the value of the refid attribute.intsize()Fulfill the ResourceCollection contract.java.lang.StringtoString()A debug toString.- 
Methods inherited from class org.apache.tools.ant.types.DataTypecheckAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.tools.ant.types.ResourceCollectionisEmpty, stream
 
- 
 
- 
- 
- 
Method Detail- 
appendNamepublic void appendName(java.lang.String name) Allow properties of a particular name in the set.- Parameters:
- name- the property name to allow.
 
 - 
appendRegexpublic void appendRegex(java.lang.String regex) Allow properties whose names match a regex in the set.- Parameters:
- regex- the regular expression to use.
 
 - 
appendPrefixpublic void appendPrefix(java.lang.String prefix) Allow properties whose names start with a prefix in the set.- Parameters:
- prefix- the prefix to use.
 
 - 
appendBuiltinpublic void appendBuiltin(PropertySet.BuiltinPropertySetName b) Allow builtin (all, system or commandline) properties in the set.- Parameters:
- b- the type of builtin properties.
 
 - 
setMapperpublic void setMapper(java.lang.String type, java.lang.String from, java.lang.String to)Set a mapper to change property names.- Parameters:
- type- mapper type.
- from- source pattern.
- to- output pattern.
 
 - 
addPropertyrefpublic void addPropertyref(PropertySet.PropertyRef ref) Add a property reference (nested element) to the references to be used.- Parameters:
- ref- a property reference.
 
 - 
addPropertysetpublic void addPropertyset(PropertySet ref) Add another property set to this set.- Parameters:
- ref- another property set.
 
 - 
createMapperpublic Mapper createMapper() Create a mapper to map the property names.- Returns:
- a mapper to be configured.
 
 - 
addpublic void add(FileNameMapper fileNameMapper) Add a nested FileNameMapper.- Parameters:
- fileNameMapper- the mapper to add.
- Since:
- Ant 1.6.3
 
 - 
setDynamicpublic void setDynamic(boolean dynamic) Set whether to reevaluate the set every time the set is used. Default is true.- Parameters:
- 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.
 
 - 
setNegatepublic void setNegate(boolean negate) Set whether to negate results. If "true", all properties not selected by nested elements will be returned. Default is "false".- Parameters:
- negate- if true, negate the selection criteria.
 
 - 
getDynamicpublic boolean getDynamic() Get the dynamic attribute.- Returns:
- true if the property set is to be evaluated each time it is used.
 
 - 
getMapperpublic Mapper getMapper() Get the mapper attribute.- Returns:
- the mapper attribute.
 
 - 
getPropertiespublic java.util.Properties getProperties() This is the operation to get the existing or recalculated properties.- Returns:
- the properties for this propertyset.
 
 - 
getRefprotected PropertySet getRef() Performs the check for circular references and returns the referenced PropertySet.- Returns:
- the referenced PropertySet.
 
 - 
setRefidpublic final void setRefid(Reference r) Sets the value of the refid attribute.- Overrides:
- setRefidin class- DataType
- Parameters:
- r- the reference this datatype should point to.
- Throws:
- BuildException- if another attribute was set, since refid and all other attributes are mutually exclusive.
 
 - 
assertNotReferenceprotected 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. - Throws:
- BuildException- if the refid attribute was already set, since refid and all other attributes are mutually exclusive.
 
 - 
toStringpublic java.lang.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.
 - 
iteratorpublic java.util.Iterator<Resource> iterator() Fulfill the ResourceCollection interface.- Specified by:
- iteratorin interface- java.lang.Iterable<Resource>
- Returns:
- an Iterator of Resources.
- Since:
- Ant 1.7
 
 - 
sizepublic int size() Fulfill the ResourceCollection contract.- Specified by:
- sizein interface- ResourceCollection
- Returns:
- the size of this ResourceCollection.
 
 - 
isFilesystemOnlypublic boolean isFilesystemOnly() Fulfill the ResourceCollection contract.- Specified by:
- isFilesystemOnlyin interface- ResourceCollection
- Returns:
- whether this is a filesystem-only resource collection.
 
 - 
dieOnCircularReferenceprotected void dieOnCircularReference(java.util.Stack<java.lang.Object> stk, Project p) throws BuildExceptionDescription copied from class:DataTypeCheck 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.checkedis true and set it to true on exit.- Overrides:
- dieOnCircularReferencein class- DataType
- Parameters:
- stk- the stack of references to check.
- p- the project to use to dereference the references.
- Throws:
- BuildException- on error.
 
 
- 
 
-