public class TypeHandler
extends java.lang.Object
Constructor and Description |
---|
TypeHandler() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
createClass(java.lang.String classname)
Returns the class whose name is
classname . |
static java.util.Date |
createDate(java.lang.String str)
Returns the date represented by
str . |
static java.io.File |
createFile(java.lang.String str)
Returns the File represented by
str . |
static java.io.File[] |
createFiles(java.lang.String str)
Returns the File[] represented by
str . |
static java.lang.Number |
createNumber(java.lang.String str)
Create a number from a String.
|
static java.lang.Object |
createObject(java.lang.String classname)
Create an Object from the classname and empty constructor.
|
static java.net.URL |
createURL(java.lang.String str)
Returns the URL represented by
str . |
static java.lang.Object |
createValue(java.lang.String str,
java.lang.Class<?> clazz)
Returns the
Object of type clazz
with the value of str . |
static java.lang.Object |
createValue(java.lang.String str,
java.lang.Object obj)
Returns the
Object of type obj
with the value of str . |
public static java.lang.Object createValue(java.lang.String str, java.lang.Object obj) throws ParseException
Object
of type obj
with the value of str
.str
- the command line valueobj
- the type of argumentobj
initialised with
the value of str
.ParseException
- if the value creation for the given object type failedpublic static java.lang.Object createValue(java.lang.String str, java.lang.Class<?> clazz) throws ParseException
Object
of type clazz
with the value of str
.str
- the command line valueclazz
- the type of argumentclazz
initialised with
the value of str
.ParseException
- if the value creation for the given class failedpublic static java.lang.Object createObject(java.lang.String classname) throws ParseException
classname
- the argument valueParseException
- if the class could not be found or the object could not be createdpublic static java.lang.Number createNumber(java.lang.String str) throws ParseException
str
- the valuestr
ParseException
- if str
is not a numberpublic static java.lang.Class<?> createClass(java.lang.String classname) throws ParseException
classname
.classname
- the class nameParseException
- if the class could not be foundpublic static java.util.Date createDate(java.lang.String str)
str
.
This method is not yet implemented and always throws an
UnsupportedOperationException
.
str
- the date stringstr
is a valid date string,
otherwise return null.java.lang.UnsupportedOperationException
- alwayspublic static java.net.URL createURL(java.lang.String str) throws ParseException
str
.str
- the URL stringstr
is well-formedParseException
- if the URL in str
is not well-formedpublic static java.io.File createFile(java.lang.String str)
str
.str
- the File locationstr
.public static java.io.File[] createFiles(java.lang.String str)
str
.
This method is not yet implemented and always throws an
UnsupportedOperationException
.
str
- the paths to the filesstr
.java.lang.UnsupportedOperationException
- always