public class OptionHelper
extends java.lang.Object
| Constructor and Description |
|---|
OptionHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
extractDefaultReplacement(java.lang.String key)
Return a String[] of size two.
|
static java.lang.String |
getAndroidSystemProperty(java.lang.String key)
Gets an Android system property
|
static java.lang.String |
getEnv(java.lang.String key)
Lookup a key from the environment.
|
static java.util.Properties |
getSystemProperties()
Very similar to
System.getProperties() except that the
SecurityException is absorbed. |
static java.lang.String |
getSystemProperty(java.lang.String key)
Very similar to
System.getProperty except that the
SecurityException is absorbed. |
static java.lang.String |
getSystemProperty(java.lang.String key,
java.lang.String def)
Very similar to
System.getProperty except that the
SecurityException is absorbed. |
static java.lang.Object |
instantiateByClassName(java.lang.String className,
java.lang.Class<?> superClass,
java.lang.ClassLoader classLoader) |
static java.lang.Object |
instantiateByClassName(java.lang.String className,
java.lang.Class<?> superClass,
Context context) |
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) |
static java.lang.Object |
instantiateByClassNameAndParameter(java.lang.String className,
java.lang.Class<?> superClass,
Context context,
java.lang.Class<?> type,
java.lang.Object param) |
static boolean |
isEmpty(java.lang.String str) |
static java.lang.String |
propertyLookup(java.lang.String key,
PropertyContainer pc1,
PropertyContainer pc2) |
static void |
setSystemProperties(ContextAware contextAware,
java.util.Properties props) |
static void |
setSystemProperty(ContextAware contextAware,
java.lang.String key,
java.lang.String value) |
static java.lang.String |
substVars(java.lang.String val,
PropertyContainer pc1) |
static java.lang.String |
substVars(java.lang.String input,
PropertyContainer pc0,
PropertyContainer pc1)
See http://logback.qos.ch/manual/configuration.html#variableSubstitution
|
static boolean |
toBoolean(java.lang.String value,
boolean defaultValue)
If
value is "true", then true is returned. |
public static java.lang.Object instantiateByClassName(java.lang.String className,
java.lang.Class<?> superClass,
Context context)
throws IncompatibleClassException,
DynamicClassLoadingException
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
public static java.lang.Object instantiateByClassName(java.lang.String className,
java.lang.Class<?> superClass,
java.lang.ClassLoader classLoader)
throws IncompatibleClassException,
DynamicClassLoadingException
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
public static java.lang.String substVars(java.lang.String val,
PropertyContainer pc1)
val - string to be evaluatedpc1 - property containersubstVars(String, PropertyContainer, PropertyContainer)public static java.lang.String substVars(java.lang.String input,
PropertyContainer pc0,
PropertyContainer pc1)
input - string to be evaluatedpc0 - primary property containerpc1 - secondary property containerpublic static java.lang.String propertyLookup(java.lang.String key,
PropertyContainer pc1,
PropertyContainer pc2)
public static java.lang.String getSystemProperty(java.lang.String key,
java.lang.String def)
System.getProperty except that the
SecurityException is absorbed.key - The key to search for.def - The default value to return.public static java.lang.String getEnv(java.lang.String key)
key - the environment variable's keypublic static java.lang.String getAndroidSystemProperty(java.lang.String key)
key - The key to search forpublic static java.lang.String getSystemProperty(java.lang.String key)
System.getProperty except that the
SecurityException is absorbed. Also checks Android
system properties as a fallback.key - The key to search for.public static void setSystemProperties(ContextAware contextAware, java.util.Properties props)
public static void setSystemProperty(ContextAware contextAware, java.lang.String key, java.lang.String value)
public static java.util.Properties getSystemProperties()
System.getProperties() except that the
SecurityException is absorbed.public static java.lang.String[] extractDefaultReplacement(java.lang.String key)
key - public static boolean toBoolean(java.lang.String value,
boolean defaultValue)
value is "true", then true is returned. If
value is "false", then true is returned.
Otherwise, default is returned.
Case of value is unimportant.
value - string to be evaluateddefaultValue - default value if value could not be convertedpublic static boolean isEmpty(java.lang.String str)