de.ispsoft.jaxme.re
Class PatternFactory

java.lang.Object
  extended byde.ispsoft.jaxme.re.PatternFactory

public class PatternFactory
extends java.lang.Object

The PatternFactory provides access to a PatternCompiler through its getPatternCompiler() method.

Author:
Jochen Wiedmann

Constructor Summary
PatternFactory()
           
 
Method Summary
static PatternCompiler getPatternCompiler()
          Returns a PatternCompiler.
static void setPatternCompiler(PatternCompiler pPatternCompiler)
          Allows to replace the default PatternCompiler with the given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternFactory

public PatternFactory()
Method Detail

setPatternCompiler

public static void setPatternCompiler(PatternCompiler pPatternCompiler)

Allows to replace the default PatternCompiler with the given.


getPatternCompiler

public static PatternCompiler getPatternCompiler()

Returns a PatternCompiler. The implementation class is choosed as follows:

  1. If a PatternCompiler has been set by the user via setPatternCompiler(PatternCompiler), returns that compiler.
  2. If the system property de.ispsoft.jaxme.re.PatternCompiler is set, instantiates the given class.
  3. Otherwise, if the resource META-INF/services/de.ispsoft.jaxme.re.PatternCompiler exists, reads the first line from this resource and instantiates the given class.
  4. Otherwise attempts to load the class Pattern. If the class can be loaded, instantiates JavaUtilPatternCompiler.
  5. Otherwise attempts to load the class org.apache.regex.RE. If the class can be loaded, instantiates ApacheRegexpPatternCompiler.
  6. Otherwise attempts to load the class Perl5Compiler. If the class can be loaded, instantiates OroPatternCompiler.
  7. Otherwise instantiates the DummyPatternCompiler, which creates dummy patterns. A dummy pattern will treat any String as matching.