net.sf.japaki.kit
Class FixedParserMold<V>
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 moldparser
- the parser returned by this moldfactory
- the factory for new elements
- Throws:
NullPointerException
- if targetType or parser is null
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