|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.parser.GenericParser
public class GenericParser
FunctorParser wrapper that adds runtime type-safe entry points to the non-generified base parser. This class maps between the inherently typeunsafe baseclass and the generic functors that are returned: if the returned functor does not return the correct type, then a ClassCastException will be thrown by the entry point.
Copyright © 2004-2005 David A. Hall
Constructor Summary | |
---|---|
GenericParser()
|
|
GenericParser(FunctorParser delegate)
|
Method Summary | ||
---|---|---|
static GenericParser |
getInstance()
Returns a globally accessible default instance of a GenericParser. |
|
java.lang.Class<?> |
getReturnType()
Returns the type of object returned by the last functor parsed. |
|
static
|
parse(java.lang.String str,
java.lang.Class<R> returnType)
Parses the string to create a Generator. |
|
static
|
parse(java.lang.String str,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
Parses the string to create a UnaryFunctor that takes an argument of the given type. |
|
static
|
parse(java.lang.String str,
java.lang.Class<T1> arg1Type,
java.lang.Class<T2> arg2Type,
java.lang.Class<R> returnType)
Parses the string to create a BinaryFunctor that takes arguments of the given types. |
|
|
parseBinary(java.lang.String str,
java.lang.Class<T1> arg1Type,
java.lang.Class<T2> arg2Type)
Parses the string to create a BinaryFunctor that takes arguments of the given types. |
|
|
parseBinary(java.lang.String str,
java.lang.Class<T1> arg1Type,
java.lang.Class<T2> arg2Type,
java.lang.Class<R> returnType)
Parses the string to create a BinaryFunctor that takes arguments of the given types. |
|
|
parseFunctor(java.lang.String str,
java.lang.Class<R> returnType,
java.lang.Class<?>... argTypes)
Parses the string to create a Functor. |
|
Generator<?> |
parseGenerator(java.lang.String str)
Parses the string to create a Generator. |
|
|
parseGenerator(java.lang.String str,
java.lang.Class<R> returnType)
Parses the string to create a Generator. |
|
|
parseUnary(java.lang.String str,
java.lang.Class<T> argType)
Parses the string to create a UnaryFunctor that takes an argument of the given type. |
|
|
parseUnary(java.lang.String str,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
Parses the string to create a UnaryFunctor that takes an argument of the given type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericParser()
public GenericParser(FunctorParser delegate)
Method Detail |
---|
public static GenericParser getInstance()
public <R> Functor<R> parseFunctor(java.lang.String str, java.lang.Class<R> returnType, java.lang.Class<?>... argTypes) throws java.lang.ClassCastException, ParseException
java.lang.ClassCastException
ParseException
public <R> Generator<R> parseGenerator(java.lang.String str, java.lang.Class<R> returnType) throws java.lang.ClassCastException, ParseException
java.lang.ClassCastException
ParseException
public <T,R> UnaryFunctor<T,R> parseUnary(java.lang.String str, java.lang.Class<T> argType, java.lang.Class<R> returnType) throws java.lang.ClassCastException, ParseException
java.lang.ClassCastException
ParseException
public <T1,T2,R> BinaryFunctor<T1,T2,R> parseBinary(java.lang.String str, java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type, java.lang.Class<R> returnType) throws java.lang.ClassCastException, ParseException
java.lang.ClassCastException
ParseException
public Generator<?> parseGenerator(java.lang.String str) throws ParseException
parseGenerator
in interface FunctorParser
ParseException
public <T> UnaryFunctor<T,?> parseUnary(java.lang.String str, java.lang.Class<T> argType) throws ParseException
parseUnary
in interface FunctorParser
ParseException
public <T1,T2> BinaryFunctor<T1,T2,?> parseBinary(java.lang.String str, java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type) throws ParseException
parseBinary
in interface FunctorParser
ParseException
public java.lang.Class<?> getReturnType()
getReturnType
in interface FunctorParser
java.lang.IllegalStateException
- if the parser has not been used or if
parsing the last functor resulted in an exception being thrown.public static <R> Generator<R> parse(java.lang.String str, java.lang.Class<R> returnType) throws UncheckedParseException, java.lang.ClassCastException
UncheckedParseException
java.lang.ClassCastException
public static <T,R> UnaryFunctor<T,R> parse(java.lang.String str, java.lang.Class<T> argType, java.lang.Class<R> returnType) throws UncheckedParseException, java.lang.ClassCastException
UncheckedParseException
java.lang.ClassCastException
public static <T1,T2,R> BinaryFunctor<T1,T2,R> parse(java.lang.String str, java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type, java.lang.Class<R> returnType) throws UncheckedParseException, java.lang.ClassCastException
UncheckedParseException
java.lang.ClassCastException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |