public final class TypeConverters extends Object
convert
package.Modifier and Type | Field and Description |
---|---|
static String |
CATEGORY
The
Plugin Category to use for TypeConverter plugins. |
Constructor and Description |
---|
TypeConverters() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convert(String s,
Class<? extends T> clazz,
Object defaultValue)
Converts a String to a given class if a TypeConverter is available for that class.
|
public static final String CATEGORY
Plugin Category
to use for TypeConverter
plugins.public static <T> T convert(String s, Class<? extends T> clazz, Object defaultValue)
null
is returned (along with a nasty status log message).s
- the string to convertclazz
- the class to try to convert the string todefaultValue
- the fallback object to use if the conversion is unsuccessfulnull
if the string is invalid for the given typeNullPointerException
- if clazz
is null
IllegalArgumentException
- if no TypeConverter exists for the given class Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.