Package ch.qos.logback.core.util

# Class OptionHelper

java.lang.Object
ch.qos.logback.core.util.OptionHelper

public class OptionHelper extends Object

Author:
  Ceki Gulcu

## Constructor Summary

Constructors
Constructor
Description
`OptionHelper()`

## Method Summary

Modifier and Type
Method
Description
`static String[]`
`extractDefaultReplacement(String key)`
Return a String[] of size two.
`static String`
`getEnv(String key)`
Lookup a key from the environment.
`static Properties`
`getSystemProperties()`
Very similar to `System.getProperties()` except that the `SecurityException` is absorbed.
`static String`
`getSystemProperty(String key)`
Very similar to `System.getProperty` except that the `SecurityException` is absorbed.
`static String`
`getSystemProperty(String key, String def)`
Very similar to `System.getProperty` except that the `SecurityException` is absorbed.
`static Object`
`instantiateByClassName(String className, Class<?> superClass, Context context)`
`static Object`
`instantiateByClassName(String className, Class<?> superClass, ClassLoader classLoader)`
`static Object`
`instantiateByClassNameAndParameter(String className, Class<?> superClass, Context context, Class<?> type, Object param)`
`static Object`
`instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter)`
`static boolean`
`isEmpty(String str)`
`static String`
`propertyLookup(String key, PropertyContainer pc1, PropertyContainer pc2)`
`static void`
`setSystemProperties(ContextAware contextAware, Properties props)`
`static void`
`setSystemProperty(ContextAware contextAware, String key, String value)`
`static String`
`substVars(String val, PropertyContainer pc1)`
`static String`
`substVars(String input, PropertyContainer pc0, PropertyContainer pc1)`
See http://logback.qos.ch/manual/configuration.html#variableSubstitution
`static boolean`
`toBoolean(String value, boolean dEfault)`
If `value` is "true", then `true` is returned.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OptionHelper

public OptionHelper()

## Method Details

### instantiateByClassName

public static Object instantiateByClassName(String className, Class<?> superClass, Context context) throws IncompatibleClassException, DynamicClassLoadingException

Throws:
  `IncompatibleClassException`
  `DynamicClassLoadingException`

### instantiateByClassNameAndParameter

public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, Context context, Class<?> type, Object param) throws IncompatibleClassException, DynamicClassLoadingException

Throws:
  `IncompatibleClassException`
  `DynamicClassLoadingException`

### instantiateByClassName

public static Object instantiateByClassName(String className, Class<?> superClass, ClassLoader classLoader) throws IncompatibleClassException, DynamicClassLoadingException

Throws:
  `IncompatibleClassException`
  `DynamicClassLoadingException`

### instantiateByClassNameAndParameter

public static Object instantiateByClassNameAndParameter(String className, Class<?> superClass, ClassLoader classLoader, Class<?> type, Object parameter) throws IncompatibleClassException, DynamicClassLoadingException

Throws:
  `IncompatibleClassException`
  `DynamicClassLoadingException`

### substVars

public static String substVars(String val, PropertyContainer pc1)

See Also:
  - `substVars(String, PropertyContainer, PropertyContainer)`

### substVars

public static String substVars(String input, PropertyContainer pc0, PropertyContainer pc1)
See http://logback.qos.ch/manual/configuration.html#variableSubstitution

### propertyLookup

public static String propertyLookup(String key, PropertyContainer pc1, PropertyContainer pc2)

### getSystemProperty

public static String getSystemProperty(String key, String def)
Very similar to `System.getProperty` except that the `SecurityException` is 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 String getEnv(String key)
Lookup a key from the environment.

Parameters:
  `key` -
Returns:
  value corresponding to key from the OS environment

### getSystemProperty

public static String getSystemProperty(String key)
Very similar to `System.getProperty` except that the `SecurityException` is absorbed.

Parameters:
  `key` - The key to search for.
Returns:
  the string value of the system property.

### setSystemProperties

public static void setSystemProperties(ContextAware contextAware, Properties props)

### setSystemProperty

public static void setSystemProperty(ContextAware contextAware, String key, String value)

### getSystemProperties

public static Properties getSystemProperties()
Very similar to `System.getProperties()` except that the `SecurityException` is absorbed.

Returns:
  the system properties

### extractDefaultReplacement

public static String[] extractDefaultReplacement(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(String value, boolean dEfault)
If `value` is "true", then `true` is returned. If `value` is "false", then `true` is returned. Otherwise, `default` is returned.

Case of value is unimportant.

### isEmpty

public static boolean isEmpty(String str)