|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.japaki.kit.ParserStore
public class ParserStore
Tries to find parsers for given parameters.
Constructor Summary | |
---|---|
ParserStore()
|
Method Summary | ||
---|---|---|
void |
add(Class<?> supertype,
Class<?> subtype)
Inserts a new class pair in the implementation map. |
|
|
add(Class<S> valueType,
Class<T> targetType,
Property<B,T> property)
Adds a new property to the transformer repository. |
|
|
add(String name,
Parser<B> parser,
Class<T> type)
Adds the parser to the mold map. |
|
ParserMold<?> |
add(String name,
ParserMold<?> mold)
Adds a mold to the mold repository. |
|
SuperParserMold<?,?,?> |
add(String name,
SuperParserMold<?,?,?> mold)
Adds a mold to the mold repository. |
|
String |
addDefault(String name,
ParserMold<?> mold)
Adds a mold to the mold repository and makes it default for its target type. |
|
String |
addDefault(String name,
SuperParserMold<?,?,?> mold)
Adds a mold to the mold repository and makes it default for its target type. |
|
|
addTransformer(Class<S> sourceType,
Class<T> targetType,
TwoWayTransformer<S,T> transformer)
Adds a new transformer to the transformer repository. |
|
|
findFactory(Class<T> type)
Creates a factory for the specified type. |
|
protected
|
findParser(ParserMold<T> mold,
Property<B,V> property,
ParserMold.Parameter parameter)
Creates a parser using the specified parameters. |
|
|
findParser(Property<B,V> property)
Creates a parser using the specified parameters. |
|
|
findParser(String parserName,
Property<B,V> property,
ParserMold.Parameter parameter)
Creates a parser using the specified parameters. |
|
|
findParser(String parserName,
Property<B,V> property,
ParserMold.Parameter parameter,
String subParserName,
Parser<Object> delParser)
Creates a parser using the specified parameters. |
|
static ParserMold.Parameter |
fromPattern(String pattern)
Creates parser mold parameters from the given pattern. |
|
static ParserStore |
getInstance()
Returns a default instance. |
|
protected Logger |
getLogger()
|
|
static ParserStore |
newDefaultInstance()
Creates a new parser store and fills it with default settings. |
|
protected void |
useDefaults(Locale locale)
Adds default entries for the specified locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParserStore()
Method Detail |
---|
protected Logger getLogger()
public static ParserStore getInstance()
public static ParserStore newDefaultInstance()
public <B,S,T> void add(Class<S> valueType, Class<T> targetType, Property<B,T> property)
valueType
- the type of the property that is usedtargetType
- the type of the parser mold that is used.property
- the transformer to be used for the specified pair
of source and target classpublic <S,T> void addTransformer(Class<S> sourceType, Class<T> targetType, TwoWayTransformer<S,T> transformer)
sourceType
- the type of the property that is usedtargetType
- the type of the parser mold that is used.transformer
- the transformer to be used for the specified pair
of source and target classprotected <B,V,T> Parser<B> findParser(ParserMold<T> mold, Property<B,V> property, ParserMold.Parameter parameter)
mold
- to be used to create the parserproperty
- the property of the new parserparameter
- the parameters to be used for the new parser
NullPointerException
- if parameter is null
or
if property or some parameter is null
and this mold does not
allow it.
IllegalArgumentException
- if the pattern cannot be interpreted
by the mold.public void add(Class<?> supertype, Class<?> subtype)
supertype
- interface or not instantiable classsubtype
- implementing class of the super class
NullPointerException
- if any class is null
DuplicateKeyException
- if one or both classes are already in the
mappublic <T> Factory<T> findFactory(Class<T> type)
type
- a class
null
if no
factory could be constructed.public ParserMold<?> add(String name, ParserMold<?> mold)
name
- name of the parser mold in the repositorymold
- the new parser mold
NullPointerException
- if name or mold is null
public String addDefault(String name, ParserMold<?> mold)
name
- name of the parser mold in the repositorymold
- the new parser mold
NullPointerException
- if name or mold is null
DuplicateKeyException
- if there is already an entry for the namepublic SuperParserMold<?,?,?> add(String name, SuperParserMold<?,?,?> mold)
name
- name of the super parser mold in the repositorymold
- the new super parser mold
NullPointerException
- if name or mold is null
public String addDefault(String name, SuperParserMold<?,?,?> mold)
name
- name of the super parser mold in the repositorymold
- the new super parser mold
NullPointerException
- if name,mold or mold's target type
is null
DuplicateKeyException
- if there is already an entry for the namepublic <B,T extends B> void add(String name, Parser<B> parser, Class<T> type)
name
- name of the super parser mold in the repositoryparser
- a parsertype
- target type for the name
NullPointerException
- if targetType or parser is null
DuplicateKeyException
- if there is already an entry for the namepublic <B,V> Parser<B> findParser(String parserName, Property<B,V> property, ParserMold.Parameter parameter, String subParserName, Parser<Object> delParser)
parserName
- name of the parserproperty
- the property of the new parserparameter
- the parameters to be used for the new parsersubParserName
- name of the element parserdelParser
- parser for delimiters
NullPointerException
- if both parserName and type are null
or subParserName is null
or if property or some parameter is null
and this mold does not
allow it.
IllegalArgumentException
- if a parser of the given name is not
found in the store
or if the pattern cannot be interpreted by the used mold.public <B,V> Parser<B> findParser(String parserName, Property<B,V> property, ParserMold.Parameter parameter)
parserName
- name of the parserproperty
- the property of the new parserparameter
- the parameters to be used for the new parser
NullPointerException
- if both parserName and the property's type
are null
or if property or some parameter is null
and this mold does not
allow it.
IllegalArgumentException
- if a parser of the given name is not
found in the store
or if the pattern cannot be interpreted by the used mold.public <B,V> Parser<B> findParser(Property<B,V> property)
property
- the property of the new parser
NullPointerException
- if the property or its target type
is null
public static final ParserMold.Parameter fromPattern(String pattern)
pattern
- a pattern string that specifies a parser
protected void useDefaults(Locale locale)
locale
- a locale
DuplicateKeyException
- if one of the entries was already in the
store
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |