org.apache.tools.ant.types

Class RegularExpression


public class RegularExpression
extends DataType

A regular expression datatype. Keeps an instance of the compiled expression for speed purposes. This compiled expression is lazily evaluated (it is compiled the first time it is needed). The syntax is the dependent on which regular expression type you are using. The system property "ant.regexp.regexpimpl" will be the classname of the implementation that will be used.
 For jdk  <= 1.3, there are two available implementations:
   org.apache.tools.ant.util.regexp.JakartaOroRegexp (the default)
        Based on the jakarta-oro package

   org.apache.tools.ant.util.regexp.JakartaRegexpRegexp
        Based on the jakarta-regexp package

 For jdk >= 1.4 an additional implementation is available:
   org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp
        Based on the jdk 1.4 built in regular expression package.
 
   <regexp [ [id="id"] pattern="expression" | refid="id" ]
   />
 
See Also:
org.apache.oro.text.regex.Perl5Compiler, org.apache.regexp.RE, java.util.regex.Pattern, Regexp

Field Summary

static String
DATA_TYPE_NAME
Name of this data type

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

checked, description, ref

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

project

Constructor Summary

RegularExpression()
default constructor

Method Summary

String
getPattern(Project p)
Gets the pattern string for this RegularExpression in the given project.
RegularExpression
getRef(Project p)
Get the RegularExpression this reference refers to in the given project.
Regexp
getRegexp(Project p)
provides a reference to the Regexp contained in this
void
setPattern(String pattern)
sets the regular expression pattern

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

checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, getCheckedRef, getDescription, getRefid, isChecked, isReference, noChildrenAllowed, setChecked, setDescription, setRefid, tooManyAttributes

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

getProject, log, log, setProject

Field Details

DATA_TYPE_NAME

public static final String DATA_TYPE_NAME
Name of this data type

Constructor Details

RegularExpression

public RegularExpression()
default constructor

Method Details

getPattern

public String getPattern(Project p)
Gets the pattern string for this RegularExpression in the given project.
Parameters:
p - project
Returns:
pattern

getRef

public RegularExpression getRef(Project p)
Get the RegularExpression this reference refers to in the given project. Check for circular references too
Parameters:
p - project
Returns:
resolved RegularExpression instance

getRegexp

public Regexp getRegexp(Project p)
provides a reference to the Regexp contained in this
Parameters:
p - project
Returns:
Regexp instance associated with this RegularExpression instance

setPattern

public void setPattern(String pattern)
sets the regular expression pattern
Parameters:
pattern - regular expression pattern

Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.