git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270511 13f79535-47bb-0310-9956-ffa450edef68master
@@ -8,7 +8,6 @@ | |||||
package org.apache.tools.ant.util.regexp; | package org.apache.tools.ant.util.regexp; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.Project; | |||||
/** | /** | ||||
* Regular expression factory, which will create Regexp objects. The actual | * Regular expression factory, which will create Regexp objects. The actual | ||||
@@ -19,44 +18,16 @@ import org.apache.tools.ant.Project; | |||||
* mattinger@mindless.com</a> | * mattinger@mindless.com</a> | ||||
* @version $Revision$ | * @version $Revision$ | ||||
*/ | */ | ||||
public class RegexpFactory extends RegexpMatcherFactory | |||||
public class RegexpFactory | |||||
extends RegexpMatcherFactory | |||||
{ | { | ||||
public RegexpFactory() | |||||
{ | |||||
} | |||||
/** | /** | ||||
* Create a new regular expression matcher instance. | * Create a new regular expression matcher instance. | ||||
* | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | */ | ||||
public Regexp newRegexp() | public Regexp newRegexp() | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
return (Regexp)newRegexp( null ); | |||||
} | |||||
/** | |||||
* Create a new regular expression matcher instance. | |||||
* | |||||
* @param p Project whose ant.regexp.regexpimpl property will be used. | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | |||||
public Regexp newRegexp( Project p ) | |||||
throws TaskException | |||||
{ | |||||
String systemDefault = null; | |||||
if( p == null ) | |||||
{ | |||||
systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
} | |||||
else | |||||
{ | |||||
systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); | |||||
} | |||||
final String systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
if( systemDefault != null ) | if( systemDefault != null ) | ||||
{ | { | ||||
return createRegexpInstance( systemDefault ); | return createRegexpInstance( systemDefault ); | ||||
@@ -66,7 +37,7 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" ); | |||||
return createRegexpInstance( JDK14_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -74,7 +45,7 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaOroRegexp" ); | |||||
return createRegexpInstance( JAKARTA_ORO ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -82,13 +53,14 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp" ); | |||||
return createRegexpInstance( JAKARTA_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
} | } | ||||
throw new TaskException( "No supported regular expression matcher found" ); | |||||
final String message = "No supported regular expression matcher found"; | |||||
throw new TaskException( message ); | |||||
} | } | ||||
/** | /** | ||||
@@ -100,11 +72,10 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
* @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
* @since 1.3 | * @since 1.3 | ||||
*/ | */ | ||||
protected Regexp createRegexpInstance( String classname ) | |||||
private Regexp createRegexpInstance( final String classname ) | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
RegexpMatcher m = createInstance( classname ); | |||||
final RegexpMatcher m = createInstance( classname ); | |||||
if( m instanceof Regexp ) | if( m instanceof Regexp ) | ||||
{ | { | ||||
return (Regexp)m; | return (Regexp)m; | ||||
@@ -8,7 +8,6 @@ | |||||
package org.apache.tools.ant.util.regexp; | package org.apache.tools.ant.util.regexp; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.Project; | |||||
/** | /** | ||||
* Simple Factory Class that produces an implementation of RegexpMatcher based | * Simple Factory Class that produces an implementation of RegexpMatcher based | ||||
@@ -22,22 +21,9 @@ import org.apache.tools.ant.Project; | |||||
*/ | */ | ||||
public class RegexpMatcherFactory | public class RegexpMatcherFactory | ||||
{ | { | ||||
public RegexpMatcherFactory() | |||||
{ | |||||
} | |||||
/** | |||||
* Create a new regular expression instance. | |||||
* | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | |||||
public RegexpMatcher newRegexpMatcher() | |||||
throws TaskException | |||||
{ | |||||
return newRegexpMatcher( null ); | |||||
} | |||||
protected static final String JAKARTA_REGEXP = "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"; | |||||
protected static final String JAKARTA_ORO = "org.apache.tools.ant.util.regexp.JakartaOroRegexp"; | |||||
protected static final String JDK14_REGEXP = "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"; | |||||
/** | /** | ||||
* Create a new regular expression instance. | * Create a new regular expression instance. | ||||
@@ -46,19 +32,10 @@ public class RegexpMatcherFactory | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
* @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
*/ | */ | ||||
public RegexpMatcher newRegexpMatcher( Project p ) | |||||
public RegexpMatcher newRegexpMatcher() | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
String systemDefault = null; | |||||
if( p == null ) | |||||
{ | |||||
systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
} | |||||
else | |||||
{ | |||||
systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); | |||||
} | |||||
final String systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
if( systemDefault != null ) | if( systemDefault != null ) | ||||
{ | { | ||||
return createInstance( systemDefault ); | return createInstance( systemDefault ); | ||||
@@ -68,7 +45,7 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher" ); | |||||
return createInstance( JDK14_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -76,7 +53,7 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.JakartaOroMatcher" ); | |||||
return createInstance( JAKARTA_ORO ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -84,16 +61,17 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpMatcher" ); | |||||
return createInstance( JAKARTA_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
} | } | ||||
throw new TaskException( "No supported regular expression matcher found" ); | |||||
final String message = "No supported regular expression matcher found"; | |||||
throw new TaskException( message ); | |||||
} | } | ||||
protected RegexpMatcher createInstance( String className ) | |||||
protected RegexpMatcher createInstance( final String className ) | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
try | try | ||||
@@ -8,7 +8,6 @@ | |||||
package org.apache.tools.ant.util.regexp; | package org.apache.tools.ant.util.regexp; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.Project; | |||||
/** | /** | ||||
* Regular expression factory, which will create Regexp objects. The actual | * Regular expression factory, which will create Regexp objects. The actual | ||||
@@ -19,44 +18,16 @@ import org.apache.tools.ant.Project; | |||||
* mattinger@mindless.com</a> | * mattinger@mindless.com</a> | ||||
* @version $Revision$ | * @version $Revision$ | ||||
*/ | */ | ||||
public class RegexpFactory extends RegexpMatcherFactory | |||||
public class RegexpFactory | |||||
extends RegexpMatcherFactory | |||||
{ | { | ||||
public RegexpFactory() | |||||
{ | |||||
} | |||||
/** | /** | ||||
* Create a new regular expression matcher instance. | * Create a new regular expression matcher instance. | ||||
* | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | */ | ||||
public Regexp newRegexp() | public Regexp newRegexp() | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
return (Regexp)newRegexp( null ); | |||||
} | |||||
/** | |||||
* Create a new regular expression matcher instance. | |||||
* | |||||
* @param p Project whose ant.regexp.regexpimpl property will be used. | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | |||||
public Regexp newRegexp( Project p ) | |||||
throws TaskException | |||||
{ | |||||
String systemDefault = null; | |||||
if( p == null ) | |||||
{ | |||||
systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
} | |||||
else | |||||
{ | |||||
systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); | |||||
} | |||||
final String systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
if( systemDefault != null ) | if( systemDefault != null ) | ||||
{ | { | ||||
return createRegexpInstance( systemDefault ); | return createRegexpInstance( systemDefault ); | ||||
@@ -66,7 +37,7 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" ); | |||||
return createRegexpInstance( JDK14_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -74,7 +45,7 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaOroRegexp" ); | |||||
return createRegexpInstance( JAKARTA_ORO ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -82,13 +53,14 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp" ); | |||||
return createRegexpInstance( JAKARTA_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
} | } | ||||
throw new TaskException( "No supported regular expression matcher found" ); | |||||
final String message = "No supported regular expression matcher found"; | |||||
throw new TaskException( message ); | |||||
} | } | ||||
/** | /** | ||||
@@ -100,11 +72,10 @@ public class RegexpFactory extends RegexpMatcherFactory | |||||
* @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
* @since 1.3 | * @since 1.3 | ||||
*/ | */ | ||||
protected Regexp createRegexpInstance( String classname ) | |||||
private Regexp createRegexpInstance( final String classname ) | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
RegexpMatcher m = createInstance( classname ); | |||||
final RegexpMatcher m = createInstance( classname ); | |||||
if( m instanceof Regexp ) | if( m instanceof Regexp ) | ||||
{ | { | ||||
return (Regexp)m; | return (Regexp)m; | ||||
@@ -8,7 +8,6 @@ | |||||
package org.apache.tools.ant.util.regexp; | package org.apache.tools.ant.util.regexp; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.tools.ant.Project; | |||||
/** | /** | ||||
* Simple Factory Class that produces an implementation of RegexpMatcher based | * Simple Factory Class that produces an implementation of RegexpMatcher based | ||||
@@ -22,22 +21,9 @@ import org.apache.tools.ant.Project; | |||||
*/ | */ | ||||
public class RegexpMatcherFactory | public class RegexpMatcherFactory | ||||
{ | { | ||||
public RegexpMatcherFactory() | |||||
{ | |||||
} | |||||
/** | |||||
* Create a new regular expression instance. | |||||
* | |||||
* @return Description of the Returned Value | |||||
* @exception TaskException Description of Exception | |||||
*/ | |||||
public RegexpMatcher newRegexpMatcher() | |||||
throws TaskException | |||||
{ | |||||
return newRegexpMatcher( null ); | |||||
} | |||||
protected static final String JAKARTA_REGEXP = "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"; | |||||
protected static final String JAKARTA_ORO = "org.apache.tools.ant.util.regexp.JakartaOroRegexp"; | |||||
protected static final String JDK14_REGEXP = "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"; | |||||
/** | /** | ||||
* Create a new regular expression instance. | * Create a new regular expression instance. | ||||
@@ -46,19 +32,10 @@ public class RegexpMatcherFactory | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
* @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
*/ | */ | ||||
public RegexpMatcher newRegexpMatcher( Project p ) | |||||
public RegexpMatcher newRegexpMatcher() | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
String systemDefault = null; | |||||
if( p == null ) | |||||
{ | |||||
systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
} | |||||
else | |||||
{ | |||||
systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); | |||||
} | |||||
final String systemDefault = System.getProperty( "ant.regexp.regexpimpl" ); | |||||
if( systemDefault != null ) | if( systemDefault != null ) | ||||
{ | { | ||||
return createInstance( systemDefault ); | return createInstance( systemDefault ); | ||||
@@ -68,7 +45,7 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher" ); | |||||
return createInstance( JDK14_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -76,7 +53,7 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.JakartaOroMatcher" ); | |||||
return createInstance( JAKARTA_ORO ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
@@ -84,16 +61,17 @@ public class RegexpMatcherFactory | |||||
try | try | ||||
{ | { | ||||
return createInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpMatcher" ); | |||||
return createInstance( JAKARTA_REGEXP ); | |||||
} | } | ||||
catch( TaskException be ) | catch( TaskException be ) | ||||
{ | { | ||||
} | } | ||||
throw new TaskException( "No supported regular expression matcher found" ); | |||||
final String message = "No supported regular expression matcher found"; | |||||
throw new TaskException( message ); | |||||
} | } | ||||
protected RegexpMatcher createInstance( String className ) | |||||
protected RegexpMatcher createInstance( final String className ) | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
try | try | ||||