public final class TypeConverter extends Object
Modifier and Type | Method and Description |
---|---|
static Boolean |
getBooleanValue(String source)
Returns a Boolean value from a String.
|
static <T> T |
getType(Class<T> targetType,
String source)
A generic method that returns the
String as the specified Java type. |
static <T> T |
getTypeViaValueOfMethod(String source,
Class<T> targetType) |
static boolean |
isConvertable(Class<?> targetType)
Tests if the class can safely be converted from a String to the
specified type.
|
public static <T> T getType(Class<T> targetType, String source)
String
as the specified Java type.T
- the type to returnsource
- the string value to converttargetType
- public static boolean isConvertable(Class<?> targetType)
targetType
- the type to convert topublic static Boolean getBooleanValue(String source)
Returns a Boolean value from a String. Unlike Boolean.#valueOf(String)
, this
method takes more String options. The following String values will return true:
While the following values will return false:
source
- public static <T> T getTypeViaValueOfMethod(String source, Class<T> targetType) throws NoSuchMethodException
T
- source
- targetType
- NoSuchMethodException
Copyright © 2018 JBoss by Red Hat. All rights reserved.