ch.qos.logback.core.android
Class SystemPropertiesProxy

java.lang.Object
  extended by ch.qos.logback.core.android.SystemPropertiesProxy

public class SystemPropertiesProxy
extends Object

A proxy to get Android's global system properties (as opposed to the default process-level system properties). Settings from `adb setprop` can be accessed from this class.


Method Summary
 String get(String key, String def)
          Get the value for the given key in the Android system properties
 Boolean getBoolean(String key, boolean def)
          Get the value for the given key in the Android system properties, returned as a boolean.
static SystemPropertiesProxy getInstance()
          Gets the singleton instance for this class
 void setClassLoader(ClassLoader cl)
          Sets the classloader to lookup the class for android.os.SystemProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SystemPropertiesProxy getInstance()
Gets the singleton instance for this class

Returns:
the singleton

setClassLoader

public void setClassLoader(ClassLoader cl)
                    throws ClassNotFoundException,
                           SecurityException,
                           NoSuchMethodException
Sets the classloader to lookup the class for android.os.SystemProperties

Parameters:
cl - desired classloader
Throws:
ClassNotFoundException
SecurityException
NoSuchMethodException

get

public String get(String key,
                  String def)
           throws IllegalArgumentException
Get the value for the given key in the Android system properties

Parameters:
key - the key to lookup
def - a default value to return
Returns:
an empty string if the key isn't found
Throws:
IllegalArgumentException - if the key exceeds 32 characters

getBoolean

public Boolean getBoolean(String key,
                          boolean def)
                   throws IllegalArgumentException
Get the value for the given key in the Android system properties, returned as a boolean. Values 'n', 'no', '0', 'false' or 'off' are considered false. Values 'y', 'yes', '1', 'true' or 'on' are considered true. (case insensitive). If the key does not exist, or has any other value, then the default result is returned.

Parameters:
key - the key to lookup
def - a default value to return
Returns:
the key parsed as a boolean, or def if the key isn't found or is not able to be parsed as a boolean.
Throws:
IllegalArgumentException - if the key exceeds 32 characters


Copyright © 2005-2013 QOS.ch. All Rights Reserved.