org.apache.tools.ant.types

Class PropertySet

public class PropertySet extends DataType

A set of properties.

Since: Ant 1.6

Nested Class Summary
static classPropertySet.BuiltinPropertySetName
Used for propertyref's builtin attribute.
static classPropertySet.PropertyRef
This is a nested class containing a reference to some properties and optionally a source of properties.
Method Summary
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(String name)
Allow properties of a particular name in the set.
voidappendPrefix(String prefix)
Allow properties whose names start with a prefix in the set.
voidappendRegex(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.
booleangetDynamic()
Get the dynamic attribute.
MappergetMapper()
Get the mapper attribute.
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.
voidsetDynamic(boolean dynamic)
Set whether to reevaluate the set everytime the set is used.
voidsetMapper(String type, String from, 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.
StringtoString()
A debug toString.

Method Detail

add

public void add(FileNameMapper fileNameMapper)
Add a nested FileNameMapper.

Parameters: fileNameMapper the mapper to add.

Since: Ant 1.6.3

addPropertyref

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

Parameters: ref a property reference.

addPropertyset

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

Parameters: ref another property set.

appendBuiltin

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

Parameters: b the type of builtin properties.

appendName

public void appendName(String name)
Allow properties of a particular name in the set.

Parameters: name the property name to allow.

appendPrefix

public void appendPrefix(String prefix)
Allow properties whose names start with a prefix in the set.

Parameters: prefix the prefix to use.

appendRegex

public void appendRegex(String regex)
Allow properties whose names match a regex in the set.

Parameters: regex the regular expression to use.

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.

Throws: BuildException if the refid attribute was already set, since refid and all other attributes are mutually exclusive.

createMapper

public Mapper createMapper()
Create a mapper to map the property names.

Returns: a mapper to be configured.

getDynamic

public boolean getDynamic()
Get the dynamic attribute.

Returns: true if the property set is to be evalulated each time it is used.

getMapper

public Mapper getMapper()
Get the mapper attribute.

Returns: the mapper attribute.

getProperties

public Properties getProperties()
This is the operation to get the existing or recalculated properties.

Returns: the properties for this propertyset.

getRef

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

Returns: the referenced PropertySet.

setDynamic

public void setDynamic(boolean dynamic)
Set whether to reevaluate the set everytime 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.

setMapper

public void setMapper(String type, String from, String to)
Set a mapper to change property names.

Parameters: type mapper type. from source pattern. to output pattern.

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".

Parameters: negate if true, negate the selection criteria.

setRefid

public final void setRefid(Reference r)
Sets the value of the refid attribute.

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.

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.

Returns: a string rep of this object.

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.