Package org.apache.tools.ant.types

# Class Substitution

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Substitution

All Implemented Interfaces:
  `Cloneable`

public class Substitution extends DataType
A regular expression substitution datatype. It is an expression that is meant to replace a regular expression.

       <substitution [ [id="id"] expression="expression" | refid="id" ]
       />

See Also:
  - `Perl5Substitution`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DATA_TYPE_NAME`
The name of this data type

### Fields inherited from class org.apache.tools.ant.types.DataType

`checked, ref`

### Fields inherited from class org.apache.tools.ant.ProjectComponent

`description, location, project`

## Constructor Summary

Constructors
Constructor
Description
`Substitution()`
Constructor for Substitution.

## Method Summary

Modifier and Type
Method
Description
`String`
`getExpression(Project p)`
Gets the pattern string for this RegularExpression in the given project.
`Substitution`
`getRef(Project p)`
Get the RegularExpression this reference refers to in the given project.
`void`
`setExpression(String expression)`
Set the pattern string for this regular expression substitution.

### Methods inherited from class org.apache.tools.ant.types.DataType

`checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes, toString`

### Methods inherited from class org.apache.tools.ant.ProjectComponent

`getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

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

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### DATA_TYPE_NAME

public static final String DATA_TYPE_NAME
The name of this data type

See Also:
  - Constant Field Values

## Constructor Details

### Substitution

public Substitution()
Constructor for Substitution.

## Method Details

### setExpression

public void setExpression(String expression)
Set the pattern string for this regular expression substitution.

Parameters:
  `expression` - the regular expression to use

### getExpression

public String getExpression(Project p)
Gets the pattern string for this RegularExpression in the given project.

Parameters:
  `p` - the project to look for the regular expression if this object is a reference
Returns:
  the pattern string

### getRef

public Substitution getRef(Project p)
Get the RegularExpression this reference refers to in the given project. Check for circular references too.

Parameters:
  `p` - the project to look for the regular expression reference
Returns:
  the resolved reference