org.java.plugin.extension.converter
Class TypeConverter
java.lang.Object
org.java.plugin.extension.converter.StringConverter<java.lang.reflect.Type>
org.java.plugin.extension.converter.TypeConverter
- All Implemented Interfaces:
- Converter<java.lang.String,java.lang.reflect.Type>, ExtendedConverter<java.lang.String,java.lang.reflect.Type>
public class TypeConverter
- extends StringConverter<java.lang.reflect.Type>
This converts a String to a type, with respect to generics. The converter need fully qualified classnames!
Only a few shortcuts are supported:
"List" -> "java.util.List"
"Map" -> "java.util.Map"
"Set" -> "java.util.Set"
"Integer" -> "java.lang.Integer"
"Float" -> "java.lang.Float"
"Double" -> "java.lang.Double"
"Boolean" -> "java.lang.Boolean"
"Long" -> "java.lang.Long"
"Number" -> "java.lang.Number"
"String" -> "java.lang.String"
"Character" -> "java.lang.Character"
"Byte" -> "java.lang.Byte"
"Object" -> "java.lang.Object"
- Author:
- Thasso Griebel (thasso.griebel@gmail.com)
Method Summary |
java.lang.reflect.Type |
convert(java.lang.String value,
java.lang.ClassLoader loader)
Converts the given source object to target type using the given classloader
to resolve any resources. |
java.lang.reflect.Type |
getTarget()
|
static java.lang.reflect.Type |
getType(java.lang.String value)
Converts the given String to a Type using this class' ClassLoader |
static java.lang.reflect.Type |
getType(java.lang.String value,
java.lang.ClassLoader loader)
Converts the given String to a Type using the given ClassLoader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_TYPE_ARRAY
public static final java.lang.reflect.Type[] EMPTY_TYPE_ARRAY
TypeConverter
public TypeConverter()
getType
public static java.lang.reflect.Type getType(java.lang.String value)
- Converts the given String to a Type using this class' ClassLoader
- Parameters:
value
- the String to convert
- Returns:
- type representing the String
getType
public static java.lang.reflect.Type getType(java.lang.String value,
java.lang.ClassLoader loader)
- Converts the given String to a Type using the given ClassLoader
- Parameters:
value
- the String to convertloader
- the loader used to load classes
- Returns:
- type representing the String
convert
public java.lang.reflect.Type convert(java.lang.String value,
java.lang.ClassLoader loader)
- Description copied from interface:
Converter
- Converts the given source object to target type using the given classloader
to resolve any resources.
- Parameters:
value
- the source valueloader
- the loader
- Returns:
- converted result
getTarget
public java.lang.reflect.Type getTarget()
- Returns:
- target type
Copyright © 2010. All Rights Reserved.