net.sf.japaki.kit
Class FixedParserMold<V>

java.lang.Object
  extended by net.sf.japaki.kit.FixedParserMold<V>
All Implemented Interfaces:
ParserMold<V>

public class FixedParserMold<V>
extends Object
implements ParserMold<V>

Simple mold that returns always the same parser.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.japaki.kit.ParserMold
ParserMold.Parameter
 
Constructor Summary
FixedParserMold(Class<V> targetType, Parser<? super V> parser, Factory<? extends V> factory)
          Creates a new fixed parser mold.
 
Method Summary
<B> Parser<B>
getParser(Property<B,V> property, ParserMold.Parameter parameter)
          Creates a parser for the specified property and pattern
 Class<V> getTargetType()
          Returns the target type of the parsers created by this mold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedParserMold

public FixedParserMold(Class<V> targetType,
                       Parser<? super V> parser,
                       Factory<? extends V> factory)
Creates a new fixed parser mold.

Parameters:
targetType - the target type of the parsers created by this mold
parser - the parser returned by this mold
factory - the factory for new elements
Throws:
NullPointerException - if targetType or parser is null
Method Detail

getParser

public <B> Parser<B> getParser(Property<B,V> property,
                               ParserMold.Parameter parameter)
Creates a parser for the specified property and pattern

Specified by:
getParser in interface ParserMold<V>
Parameters:
property - property of the created parser. If it is null the underlying parser is returned, otherwise a PropertyParser with the underlying parser is created.
parameter - ignored
Returns:
new parser

getTargetType

public Class<V> getTargetType()
Description copied from interface: ParserMold
Returns the target type of the parsers created by this mold.

Specified by:
getTargetType in interface ParserMold<V>
Returns:
the target type of the parsers created by this mold