public class TypeHandler extends Object
| Constructor and Description |
|---|
TypeHandler() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
createClass(String classname)
Returns the class whose name is
classname. |
static Date |
createDate(String str)
Returns the date represented by
str. |
static File |
createFile(String str)
Returns the File represented by
str. |
static File[] |
createFiles(String str)
Returns the File[] represented by
str. |
static Number |
createNumber(String str)
Create a number from a String.
|
static Object |
createObject(String classname)
Create an Object from the classname and empty constructor.
|
static URL |
createURL(String str)
Returns the URL represented by
str. |
static <T> T |
createValue(String str,
Class<T> clazz)
Returns the
Object of type clazz with the value of str. |
static Object |
createValue(String str,
Object obj)
Returns the
Object of type obj with the value of str. |
static FileInputStream |
openFile(String str)
Returns the opened FileInputStream represented by
str. |
public static Class<?> createClass(String classname) throws ParseException
classname.classname - the class nameParseException - if the class could not be foundpublic static Date createDate(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.UnsupportedOperationException - alwayspublic static File createFile(String str)
str.str - the File locationstr.public static File[] createFiles(String str)
str.
This method is not yet implemented and always throws an UnsupportedOperationException.
str - the paths to the filesstr.UnsupportedOperationException - alwayspublic static Number createNumber(String str) throws ParseException
str - the valuestrParseException - if str is not a numberpublic static Object createObject(String classname) throws ParseException
classname - the argument valueParseException - if the class could not be found or the object could not be createdpublic static URL createURL(String str) throws ParseException
str.str - the URL stringstr is well-formedParseException - if the URL in str is not well-formedpublic static <T> T createValue(String str, Class<T> clazz) throws ParseException
Object of type clazz with the value of str.T - type of argumentstr - the command line valueclazz - the class representing the type of argumentclazz initialized with the value of str.ParseException - if the value creation for the given class failedpublic static Object createValue(String str, Object obj) throws ParseException
Object of type obj with the value of str.str - the command line valueobj - the type of argumentobj initialized with the value of str.ParseException - if the value creation for the given object type failedpublic static FileInputStream openFile(String str) throws ParseException
str.str - the file locationstr.ParseException - if the file is not exist or not readableCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.