Top Description Inners Fields Constructors Methods
org.apache.tools.ant.types

public Class PropertySet

extends DataType
implements ResourceCollection
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.types.ResourceCollection, java.lang.Iterable
Imports
java.util.AbstractMap, .ArrayList, .HashMap, .HashSet, .Iterator, .List, .Map, .Optional, .Properties, .Set, .Stack, .TreeMap, java.util.stream.Collectors, .Stream, org.apache.tools.ant.BuildException, .Project, .PropertyHelper, org.apache.tools.ant.types.resources.MappedResource, .PropertyResource, org.apache.tools.ant.util.FileNameMapper, org.apache.tools.ant.util.regexp.RegexpMatcher, .RegexpMatcherFactory

A set of properties.
Since
Ant 1.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PropertySet.BuiltinPropertySetName

Used for propertyref's builtin attribute.

public static class
PropertySet.PropertyRef

This is a nested class containing a reference to some properties and optionally a source of properties.

Field Summary

Modifier and TypeField and Description
private Set<String>
private boolean
private Mapper
private boolean
private boolean
noAttributeSet

Flag which tracks whether any attribute has been set; used by assertNotReference() and setRefid(Reference).

private List<PropertySet.PropertyRef>
private List<PropertySet>
Inherited from org.apache.tools.ant.types.DataType:
checkedref

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(FileNameMapper
the mapper to add.
fileNameMapper
)

Add a nested FileNameMapper.

private void
addPropertyNames(Set<String>
the output Set to fill with the property names matching this PropertySet selection criteria.
names
,
Map<String, Object>
the current Project properties, passed in to avoid needless duplication of the Hashtable during recursion.
props
)

public void
addPropertyref(PropertySet.PropertyRef
a property reference.
ref
)

Add a property reference (nested element) to the references to be used.

public void
addPropertyset(PropertySet
another property set.
ref
)

Add another property set to this set.

public void
appendBuiltin(PropertySet.BuiltinPropertySetName
the type of builtin properties.
b
)

Allow builtin (all, system or commandline) properties in the set.

public void
appendName(String
the property name to allow.
name
)

Allow properties of a particular name in the set.

public void
appendPrefix(String
the prefix to use.
prefix
)

Allow properties whose names start with a prefix in the set.

public void
appendRegex(String
the regular expression to use.
regex
)

Allow properties whose names match a regex in the set.

protected final void
assertNotReference()

Ensures this data type is not a reference.

public Mapper

Returns:

a mapper to be configured.
createMapper
()

Create a mapper to map the property names.

protected synchronized void
dieOnCircularReference(Stack<Object>
the stack of references to check.
stk
,
Project
the project to use to dereference the references.
p
)

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

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).
private Map<String, Object>
getAllSystemProperties()

Convert the system properties to a Map.

public boolean

Returns:

true if the property set is to be evaluated each time it is used.
getDynamic
()

Get the dynamic attribute.

private Map<String, Object>
public Mapper

Returns:

the mapper attribute.
getMapper
()

Get the mapper attribute.

public Properties

Returns:

the properties for this propertyset.
getProperties
()

This is the operation to get the existing or recalculated properties.

private Map<String, Object>

Returns:

Map
getPropertyMap
()

private Set<String>
protected PropertySet

Returns:

the referenced PropertySet.
getRef
()

Performs the check for circular references and returns the referenced PropertySet.

public boolean

Returns:

whether this is a filesystem-only resource collection.
isFilesystemOnly
()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Fulfill the ResourceCollection contract.
public Iterator<Resource>

Returns:

an Iterator of Resources.
iterator
()

Implements java.lang.Iterable.iterator.

Fulfill the ResourceCollection interface.
public void
setDynamic(boolean
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.
dynamic
)

Set whether to reevaluate the set every time the set is used.

public void
setMapper(String
mapper type.
type
,
String
source pattern.
from
,
String
output pattern.
to
)

Set a mapper to change property names.

public void
setNegate(boolean
if true, negate the selection criteria.
negate
)

Set whether to negate results.

public final void
setRefid(Reference
the reference this datatype should point to.
r
)

Overrides org.apache.tools.ant.types.DataType.setRefid.

Sets the value of the refid attribute.
public int

Returns:

the size of this ResourceCollection.
size
()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Fulfill the ResourceCollection contract.
public String

Returns:

a string rep of this object.
toString
()

Overrides org.apache.tools.ant.types.DataType.toString.

A debug toString.
Inherited from org.apache.tools.ant.types.DataType:
checkAttributesAllowedcheckChildrenAllowedcircularReferenceclonedieOnCircularReferencedieOnCircularReferencegetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetCheckedRefgetDataTypeNamegetRefidinvokeCircularReferenceCheckisCheckedisReferencenoChildrenAllowedpushAndInvokeCircularReferenceChecksetCheckedtooManyAttributes

Field Detail

cachedNamesback to summary
private Set<String> cachedNames
dynamicback to summary
private boolean dynamic
mapperback to summary
private Mapper mapper
negateback to summary
private boolean negate
noAttributeSetback to summary
private boolean noAttributeSet

Flag which tracks whether any attribute has been set; used by assertNotReference() and setRefid(Reference).

ptyRefsback to summary
private List<PropertySet.PropertyRef> ptyRefs
setRefsback to summary
private List<PropertySet> setRefs

Constructor Detail

PropertySetback to summary
public PropertySet()

Method Detail

addback to summary
public void add(FileNameMapper fileNameMapper)

Add a nested FileNameMapper.

Parameters
fileNameMapper:FileNameMapper

the mapper to add.

Since
Ant 1.6.3
addPropertyNamesback to summary
private void addPropertyNames(Set<String> names, Map<String, Object> props)
Parameters
names:Set<String>

the output Set to fill with the property names matching this PropertySet selection criteria.

props:Map<String, Object>

the current Project properties, passed in to avoid needless duplication of the Hashtable during recursion.

addPropertyrefback to summary
public void addPropertyref(PropertySet.PropertyRef ref)

Add a property reference (nested element) to the references to be used.

Parameters
ref:PropertySet.PropertyRef

a property reference.

addPropertysetback to summary
public void addPropertyset(PropertySet ref)

Add another property set to this set.

Parameters
ref:PropertySet

another property set.

appendBuiltinback to summary
public void appendBuiltin(PropertySet.BuiltinPropertySetName b)

Allow builtin (all, system or commandline) properties in the set.

Parameters
b:PropertySet.BuiltinPropertySetName

the type of builtin properties.

appendNameback to summary
public void appendName(String name)

Allow properties of a particular name in the set.

Parameters
name:String

the property name to allow.

appendPrefixback to summary
public void appendPrefix(String prefix)

Allow properties whose names start with a prefix in the set.

Parameters
prefix:String

the prefix to use.

appendRegexback to summary
public void appendRegex(String regex)

Allow properties whose names match a regex in the set.

Parameters
regex:String

the regular expression to use.

assertNotReferenceback to summary
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.

Exceptions
BuildException:
if the refid attribute was already set, since refid and all other attributes are mutually exclusive.
createMapperback to summary
public Mapper createMapper()

Create a mapper to map the property names.

Returns:Mapper

a mapper to be configured.

dieOnCircularReferenceback to summary
protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

Doc from org.apache.tools.ant.types.DataType.dieOnCircularReference.

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 checked is true and set it to true on exit.

Parameters
stk:Stack<Object>

the stack of references to check.

p:Project

the project to use to dereference the references.

Annotations
@Override
Exceptions
BuildException:
on error.
getAllSystemPropertiesback to summary
private Map<String, Object> getAllSystemProperties()

Convert the system properties to a Map. Use stringPropertyNames to get the list of properties (including default ones).

getDynamicback to summary
public boolean getDynamic()

Get the dynamic attribute.

Returns:boolean

true if the property set is to be evaluated each time it is used.

getEffectivePropertiesback to summary
private Map<String, Object> getEffectiveProperties()
getMapperback to summary
public Mapper getMapper()

Get the mapper attribute.

Returns:Mapper

the mapper attribute.

getPropertiesback to summary
public Properties getProperties()

This is the operation to get the existing or recalculated properties.

Returns:Properties

the properties for this propertyset.

getPropertyMapback to summary
private Map<String, Object> getPropertyMap()
Returns:Map<String, Object>

Map

Since
1.9.0
getPropertyNamesback to summary
private Set<String> getPropertyNames(Map<String, Object> props)
getRefback to summary
protected PropertySet getRef()

Performs the check for circular references and returns the referenced PropertySet.

Returns:PropertySet

the referenced PropertySet.

isFilesystemOnlyback to summary
public boolean isFilesystemOnly()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Fulfill the ResourceCollection contract.

Returns:boolean

whether this is a filesystem-only resource collection.

Annotations
@Override
iteratorback to summary
public Iterator<Resource> iterator()

Implements java.lang.Iterable.iterator.

Fulfill the ResourceCollection interface.

Returns:Iterator<Resource>

an Iterator of Resources.

Annotations
@Override
Since
Ant 1.7
setDynamicback to summary
public void setDynamic(boolean dynamic)

Set whether to reevaluate the set every time the set is used. Default is true.

Parameters
dynamic:boolean

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.

setMapperback to summary
public void setMapper(String type, String from, String to)

Set a mapper to change property names.

Parameters
type:String

mapper type.

from:String

source pattern.

to:String

output pattern.

setNegateback to summary
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".

Parameters
negate:boolean

if true, negate the selection criteria.

setRefidback to summary
public final void setRefid(Reference r)

Overrides org.apache.tools.ant.types.DataType.setRefid.

Sets the value of the refid attribute.

Parameters
r:Reference

the reference this datatype should point to.

Annotations
@Override
Exceptions
BuildException:
if another attribute was set, since refid and all other attributes are mutually exclusive.
sizeback to summary
public int size()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Fulfill the ResourceCollection contract.

Returns:int

the size of this ResourceCollection.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.apache.tools.ant.types.DataType.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.

Returns:String

a string rep of this object.

Annotations
@Override
org.apache.tools.ant.types back to summary

public Class PropertySet.BuiltinPropertySetName

extends EnumeratedAttribute
Class Inheritance

Used for propertyref's builtin attribute.

Field Summary

Modifier and TypeField and Description
pack-priv static final String
pack-priv static final String
pack-priv static final String
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]
getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

ALLback to summary
pack-priv static final String ALL
COMMANDLINEback to summary
pack-priv static final String COMMANDLINE
SYSTEMback to summary
pack-priv static final String SYSTEM

Constructor Detail

BuiltinPropertySetNameback to summary
public BuiltinPropertySetName()

Method Detail

getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Doc from org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement..

Returns:String[]

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.

Annotations
@Override
org.apache.tools.ant.types back to summary

public Class PropertySet.PropertyRef

extends Object
Class Inheritance

This is a nested class containing a reference to some properties and optionally a source of properties.

Field Summary

Modifier and TypeField and Description
private String
private int
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
assertValid(String attr, String value)

public void
setBuiltin(PropertySet.BuiltinPropertySetName
an enumerated BuildinPropertySetName value.
b
)

Builtin property names - all, system or commandline.

public void
setName(String
a String value.
name
)

Set the name.

public void
setPrefix(String
a String value.
prefix
)

Set the prefix to use.

public void
setRegex(String
a regular expression.
regex
)

Set the regular expression to use to filter the properties.

public String

Returns:

a string version of this object.
toString
()

Overrides java.lang.Object.toString.

A debug toString().
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

builtinback to summary
private String builtin
countback to summary
private int count
nameback to summary
private String name
prefixback to summary
private String prefix
regexback to summary
private String regex

Constructor Detail

PropertyRefback to summary
public PropertyRef()

Method Detail

assertValidback to summary
private void assertValid(String attr, String value)
setBuiltinback to summary
public void setBuiltin(PropertySet.BuiltinPropertySetName b)

Builtin property names - all, system or commandline.

Parameters
b:PropertySet.BuiltinPropertySetName

an enumerated BuildinPropertySetName value.

setNameback to summary
public void setName(String name)

Set the name.

Parameters
name:String

a String value.

setPrefixback to summary
public void setPrefix(String prefix)

Set the prefix to use.

Parameters
prefix:String

a String value.

setRegexback to summary
public void setRegex(String regex)

Set the regular expression to use to filter the properties.

Parameters
regex:String

a regular expression.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

A debug toString().

Returns:String

a string version of this object.

Annotations
@Override