|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.core.config.plugins.util.TypeConverters
public final class TypeConverters
Collection of basic TypeConverter implementations. May be used to register additional TypeConverters or find registered TypeConverters.
Method Summary | |
---|---|
static Object |
convert(String s,
Class<?> clazz,
Object defaultValue)
Converts a String to a given class if a TypeConverter is available for that class. |
static TypeConverter<?> |
findTypeConverter(Class<?> clazz)
Locates a TypeConverter for a specified class. |
static void |
registerTypeConverter(Class<?> clazz,
TypeConverter<?> converter)
Registers a TypeConverter for a specified class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Object convert(String s, Class<?> 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 unsuccessful
null
if the string is invalid for the given type
NullPointerException
- if clazz
is null
IllegalArgumentException
- if no TypeConverter exists for the given classpublic static TypeConverter<?> findTypeConverter(Class<?> clazz)
clazz
- the class to get a TypeConverter for
null
if none could be foundpublic static void registerTypeConverter(Class<?> clazz, TypeConverter<?> converter)
clazz
- the class to register the TypeConverter forconverter
- the TypeConverter to register
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2014 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.