*I want to register a TypeParser that operates on all subclasses of the provided class.
More concretely I want to do this:
builder.registerTypeParser(Number.class, new TypeParser() {...})
return parser.parseType(string, invocation.getMethod().getGenericReturnType()); //returntype is Integer
My problem that there exist a lot of subtypes of my superclass and I don't want to register the same TypeParser for all(I might not know all of them) of them .
I also though and tried this:
builder.registerTypeParser(new GenericType<? extends Number>() {},new TypeParserImplementation());
which unfortunately isn't allowed.
If a TypeParser for a specific type is not found could it look for a TypeParser where TypeParserForClass.isAssignableFrom(SpecificClassWithoutTypeParser.class)
*If such subclass typeParsing as above is added the expected type would be nice to access from within a TypeParser.
new TypeParser() {
public ConfigurationData parse(String input,Class expectedType, TypeParserHelper helper) {
if(expectedType instanceof Integer){}
if(expectedType instanceof Float){}
}
*I want to register a TypeParser that operates on all subclasses of the provided class.
More concretely I want to do this:
builder.registerTypeParser(Number.class, new TypeParser() {...})
return parser.parseType(string, invocation.getMethod().getGenericReturnType()); //returntype is Integer
My problem that there exist a lot of subtypes of my superclass and I don't want to register the same TypeParser for all(I might not know all of them) of them .
I also though and tried this:
builder.registerTypeParser(new GenericType<? extends Number>() {},new TypeParserImplementation());
which unfortunately isn't allowed.
If a TypeParser for a specific type is not found could it look for a TypeParser where TypeParserForClass.isAssignableFrom(SpecificClassWithoutTypeParser.class)
*If such subclass typeParsing as above is added the expected type would be nice to access from within a TypeParser.
new TypeParser() {
public ConfigurationData parse(String input,Class expectedType, TypeParserHelper helper) {
if(expectedType instanceof Integer){}
if(expectedType instanceof Float){}
}