Package ch.qos.logback.core.util
Class OptionHelper
- java.lang.Object
-
- ch.qos.logback.core.util.OptionHelper
-
public class OptionHelper extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String_IS_UNDEFINED(package private) static java.lang.StringDELIM_DEFAULT(package private) static intDELIM_DEFAULT_LEN(package private) static java.lang.StringDELIM_STARTFind the value corresponding tokeyinprops.(package private) static intDELIM_START_LEN(package private) static charDELIM_STOP(package private) static intDELIM_STOP_LEN
-
Constructor Summary
Constructors Constructor Description OptionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]extractDefaultReplacement(java.lang.String key)Return a String[] of size two.static java.lang.StringgetEnv(java.lang.String key)Lookup a key from the environment.static java.util.PropertiesgetSystemProperties()Very similar toSystem.getProperties()except that theSecurityExceptionis absorbed.static java.lang.StringgetSystemProperty(java.lang.String key)Very similar toSystem.getPropertyexcept that theSecurityExceptionis absorbed.static java.lang.StringgetSystemProperty(java.lang.String key, java.lang.String def)Very similar toSystem.getPropertyexcept that theSecurityExceptionis absorbed.static java.lang.ObjectinstantiateByClassName(java.lang.String className, java.lang.Class<?> superClass, Context context)static java.lang.ObjectinstantiateByClassName(java.lang.String className, java.lang.Class<?> superClass, java.lang.ClassLoader classLoader)static java.lang.ObjectinstantiateByClassNameAndParameter(java.lang.String className, java.lang.Class<?> superClass, Context context, java.lang.Class<?> type, java.lang.Object param)static java.lang.ObjectinstantiateByClassNameAndParameter(java.lang.String className, java.lang.Class<?> superClass, java.lang.ClassLoader classLoader, java.lang.Class<?> type, java.lang.Object parameter)static java.lang.ObjectinstantiateClassWithSuperclassRestriction(java.lang.Class<?> classObj, java.lang.Class<?> superClass)static booleanisEmpty(java.lang.String str)static booleanisNotEmtpy(java.lang.Object[] array)static booleanisNullOrEmpty(java.lang.Object[] array)static java.lang.StringpropertyLookup(java.lang.String key, PropertyContainer pc1, PropertyContainer pc2)static voidsetSystemProperties(ContextAware contextAware, java.util.Properties props)static voidsetSystemProperty(ContextAware contextAware, java.lang.String key, java.lang.String value)static java.lang.StringsubstVars(java.lang.String val, PropertyContainer pc1)static java.lang.StringsubstVars(java.lang.String input, PropertyContainer pc0, PropertyContainer pc1)See http://logback.qos.ch/manual/configuration.html#variableSubstitutionstatic booleantoBoolean(java.lang.String value, boolean dEfault)Ifvalueis "true", thentrueis returned.
-
-
-
Field Detail
-
DELIM_START
static final java.lang.String DELIM_START
Find the value corresponding tokeyinprops. Then perform variable substitution on the found value.- See Also:
- Constant Field Values
-
DELIM_STOP
static final char DELIM_STOP
- See Also:
- Constant Field Values
-
DELIM_DEFAULT
static final java.lang.String DELIM_DEFAULT
- See Also:
- Constant Field Values
-
DELIM_START_LEN
static final int DELIM_START_LEN
- See Also:
- Constant Field Values
-
DELIM_STOP_LEN
static final int DELIM_STOP_LEN
- See Also:
- Constant Field Values
-
DELIM_DEFAULT_LEN
static final int DELIM_DEFAULT_LEN
- See Also:
- Constant Field Values
-
_IS_UNDEFINED
static final java.lang.String _IS_UNDEFINED
- See Also:
- Constant Field Values
-
-
Method Detail
-
instantiateByClassName
public static java.lang.Object instantiateByClassName(java.lang.String className, java.lang.Class<?> superClass, Context context) throws IncompatibleClassException, DynamicClassLoadingException
-
instantiateByClassNameAndParameter
public static java.lang.Object instantiateByClassNameAndParameter(java.lang.String className, java.lang.Class<?> superClass, Context context, java.lang.Class<?> type, java.lang.Object param) throws IncompatibleClassException, DynamicClassLoadingException
-
instantiateByClassName
public static java.lang.Object instantiateByClassName(java.lang.String className, java.lang.Class<?> superClass, java.lang.ClassLoader classLoader) throws IncompatibleClassException, DynamicClassLoadingException
-
instantiateClassWithSuperclassRestriction
public static java.lang.Object instantiateClassWithSuperclassRestriction(java.lang.Class<?> classObj, java.lang.Class<?> superClass) throws IncompatibleClassException, DynamicClassLoadingException
-
instantiateByClassNameAndParameter
public static java.lang.Object instantiateByClassNameAndParameter(java.lang.String className, java.lang.Class<?> superClass, java.lang.ClassLoader classLoader, java.lang.Class<?> type, java.lang.Object parameter) throws IncompatibleClassException, DynamicClassLoadingException
-
substVars
public static java.lang.String substVars(java.lang.String val, PropertyContainer pc1)
-
substVars
public static java.lang.String substVars(java.lang.String input, PropertyContainer pc0, PropertyContainer pc1)See http://logback.qos.ch/manual/configuration.html#variableSubstitution
-
propertyLookup
public static java.lang.String propertyLookup(java.lang.String key, PropertyContainer pc1, PropertyContainer pc2)
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.String key, java.lang.String def)Very similar toSystem.getPropertyexcept that theSecurityExceptionis absorbed.- Parameters:
key- The key to search for.def- The default value to return.- Returns:
- the string value of the system property, or the default value if there is no property with that key.
-
getEnv
public static java.lang.String getEnv(java.lang.String key)
Lookup a key from the environment.- Parameters:
key-- Returns:
- value corresponding to key from the OS environment
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.String key)
Very similar toSystem.getPropertyexcept that theSecurityExceptionis absorbed.- Parameters:
key- The key to search for.- Returns:
- the string value of the system property.
-
setSystemProperties
public static void setSystemProperties(ContextAware contextAware, java.util.Properties props)
-
setSystemProperty
public static void setSystemProperty(ContextAware contextAware, java.lang.String key, java.lang.String value)
-
getSystemProperties
public static java.util.Properties getSystemProperties()
Very similar toSystem.getProperties()except that theSecurityExceptionis absorbed.- Returns:
- the system properties
-
extractDefaultReplacement
public static java.lang.String[] extractDefaultReplacement(java.lang.String key)
Return a String[] of size two. The first item containing the key part and the second item containing a default value specified by the user. The second item will be null if no default value is specified.- Parameters:
key-- Returns:
-
toBoolean
public static boolean toBoolean(java.lang.String value, boolean dEfault)Ifvalueis "true", thentrueis returned. Ifvalueis "false", thentrueis returned. Otherwise,defaultis returned.Case of value is unimportant.
-
isEmpty
public static boolean isEmpty(java.lang.String str)
-
isNullOrEmpty
public static final boolean isNullOrEmpty(java.lang.Object[] array)
-
isNotEmtpy
public static final boolean isNotEmtpy(java.lang.Object[] array)
-
-