com.parse

## Class ParseConfig

- java.lang.Object
- - com.parse.ParseConfig

    public class ParseConfig
    extends Object

The `ParseConfig` is a local representation of configuration data that can be set from the Parse dashboard.

### Method Summary

Methods
`static ParseConfig` `get()` Fetches a new configuration object from the server.
`Object` `get(String key)` Access a value.
`Object` `get(String key, Object defaultValue)` Access a value, returning a default value if the key doesn't exist.
`boolean` `getBoolean(String key)` Access a `boolean` value.
`boolean` `getBoolean(String key, boolean defaultValue)` Access a `boolean` value, returning a default value if it doesn't exist.
`static ParseConfig` `getCurrentConfig()` Retrieves the most recently-fetched configuration object, either from memory or disk if necessary.
`Date` `getDate(String key)` Access a `Date` value.
`Date` `getDate(String key, Date defaultValue)` Access a `Date` value, returning a default value if it doesn't exist.
`double` `getDouble(String key)` Access a `double` value.
`double` `getDouble(String key, double defaultValue)` Access a `double` value, returning a default value if it doesn't exist.
`static Task<ParseConfig>` `getInBackground()` Fetches a new configuration object from the server in a background thread.
`static void` `getInBackground(ConfigCallback callback)` Fetches a new configuration object from the server in a background thread.
`int` `getInt(String key)` Access an `int` value.
`int` `getInt(String key, int defaultValue)` Access an `int` value, returning a default value if it doesn't exist.
`JSONArray` `getJSONArray(String key)` Access a `JSONArray` value.
`JSONArray` `getJSONArray(String key, JSONArray defaultValue)` Access a `JSONArray` value, returning a default value if it doesn't exist.
`JSONObject` `getJSONObject(String key)` Access a `JSONObject` value.
`JSONObject` `getJSONObject(String key, JSONObject defaultValue)` Access a `JSONObject` value, returning a default value if it doesn't exist.
`<T> List<T>` `getList(String key)` Access a `List` value.
`<T> List<T>` `getList(String key, List<T> defaultValue)` Access a `List` value, returning a default value if it doesn't exist.
`long` `getLong(String key)` Access a `long` value.
`long` `getLong(String key, long defaultValue)` Access a `long` value, returning a default value if it doesn't exist.
`<V> Map<String,V>` `getMap(String key)` Access a `Map` value.
`<V> Map<String,V>` `getMap(String key, Map<String,V> defaultValue)` Access a `Map` value, returning a default value if it doesn't exist.
`Number` `getNumber(String key)` Access a numerical value.
`Number` `getNumber(String key, Number defaultValue)` Access a numerical value, returning a default value if it doesn't exist.
`ParseFile` `getParseFile(String key)` Access a `ParseFile` value.
`ParseFile` `getParseFile(String key, ParseFile defaultValue)` Access a `ParseFile` value, returning a default value if it doesn't exist.
`ParseGeoPoint` `getParseGeoPoint(String key)` Access a `ParseGeoPoint` value.
`ParseGeoPoint` `getParseGeoPoint(String key, ParseGeoPoint defaultValue)` Access a `ParseGeoPoint` value, returning a default value if it doesn't exist.
`String` `getString(String key)` Access a `String` value.
`String` `getString(String key, String defaultValue)` Access a `String` value, returning a default value if it doesn't exist.
`String` `toString()`

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

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

### Method Detail

#### getCurrentConfig

    public static ParseConfig getCurrentConfig()

Retrieves the most recently-fetched configuration object, either from memory or disk if necessary.

Returns:
  The most recently-fetched `ParseConfig` if it exists, else an empty `ParseConfig`

#### get

    public static ParseConfig get()
                           throws ParseException

Fetches a new configuration object from the server.

Returns:
  The `ParseConfig` that was fetched.
Throws:
  `ParseException` - Throws an exception if the server is inaccessible.

#### getInBackground

    public static void getInBackground(ConfigCallback callback)

Fetches a new configuration object from the server in a background thread. This is preferable to using `ParseConfig.get()`, unless your code is already running from a background thread.

Parameters:
  `callback` - callback.done(config, e) is called when the fetch completes.

#### getInBackground

    public static Task<ParseConfig> getInBackground()

Fetches a new configuration object from the server in a background thread. This is preferable to using `ParseConfig.get()`, unless your code is already running from a background thread.

Returns:
  A Task that is resolved when the fetch completes.

#### get

    public Object get(String key)

Access a value. In most cases it is more convenient to use a helper function such as `ParseConfig.getString(java.lang.String)` or `ParseConfig.getInt(java.lang.String)`.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key.

#### get

    public Object get(String key,
             Object defaultValue)

Access a value, returning a default value if the key doesn't exist. In most cases it is more convenient to use a helper function such as `ParseConfig.getString(java.lang.String)` or `ParseConfig.getInt(java.lang.String)`.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present in the configuration object.
Returns:
  The default value if there is no such key.

#### getBoolean

    public boolean getBoolean(String key)

Access a `boolean` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns false if there is no such key or if it is not a `boolean`.

#### getBoolean

    public boolean getBoolean(String key,
                     boolean defaultValue)

Access a `boolean` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `boolean`.

#### getDate

    public Date getDate(String key)

Access a `Date` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it is not a `Date`.

#### getDate

    public Date getDate(String key,
               Date defaultValue)

Access a `Date` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `Date`.

#### getDouble

    public double getDouble(String key)

Access a `double` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns 0 if there is no such key or if it is not a number.

#### getDouble

    public double getDouble(String key,
                   double defaultValue)

Access a `double` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a number.

#### getInt

    public int getInt(String key)

Access an `int` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns 0 if there is no such key or if it is not a number.

#### getInt

    public int getInt(String key,
             int defaultValue)

Access an `int` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a number.

#### getJSONArray

    public JSONArray getJSONArray(String key)

Access a `JSONArray` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it is not a `JSONArray`.

#### getJSONArray

    public JSONArray getJSONArray(String key,
                         JSONArray defaultValue)

Access a `JSONArray` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `JSONArray`.

#### getJSONObject

    public JSONObject getJSONObject(String key)

Access a `JSONObject` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it is not a `JSONObject`.

#### getJSONObject

    public JSONObject getJSONObject(String key,
                           JSONObject defaultValue)

Access a `JSONObject` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `JSONObject`.

#### getList

    public <T> List<T> getList(String key)

Access a `List` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it cannot be converted to a `List`.

#### getList

    public <T> List<T> getList(String key,
                      List<T> defaultValue)

Access a `List` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it cannot be converted to a `List`.

#### getLong

    public long getLong(String key)

Access a `long` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns 0 if there is no such key or if it is not a number.

#### getLong

    public long getLong(String key,
               long defaultValue)

Access a `long` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a number.

#### getMap

    public <V> Map<String,V> getMap(String key)

Access a `Map` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  `null` if there is no such key or if it cannot be converted to a `Map`.

#### getMap

    public <V> Map<String,V> getMap(String key,
                           Map<String,V> defaultValue)

Access a `Map` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it cannot be converted to a `Map`.

#### getNumber

    public Number getNumber(String key)

Access a numerical value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it is not a `Number`.

#### getNumber

    public Number getNumber(String key,
                   Number defaultValue)

Access a numerical value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `Number`.

#### getParseFile

    public ParseFile getParseFile(String key)

Access a `ParseFile` value. This function will not perform a network request. Unless the `ParseFile` has been downloaded (e.g. by calling `ParseFile.getData()`), `ParseFile.isDataAvailable()` will return false.

Parameters:
  `key` - The key to access the value for.
Returns:
  `null` if there is no such key or if it is not a `ParseFile`.

#### getParseFile

    public ParseFile getParseFile(String key,
                         ParseFile defaultValue)

Access a `ParseFile` value, returning a default value if it doesn't exist. This function will not perform a network request. Unless the `ParseFile` has been downloaded (e.g. by calling `ParseFile.getData()`), `ParseFile.isDataAvailable()` will return false.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `ParseFile`.

#### getParseGeoPoint

    public ParseGeoPoint getParseGeoPoint(String key)

Access a `ParseGeoPoint` value.

Parameters:
  `key` - The key to access the value for
Returns:
  `null` if there is no such key or if it is not a `ParseGeoPoint`.

#### getParseGeoPoint

    public ParseGeoPoint getParseGeoPoint(String key,
                                 ParseGeoPoint defaultValue)

Access a `ParseGeoPoint` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `ParseGeoPoint`.

#### getString

    public String getString(String key)

Access a `String` value.

Parameters:
  `key` - The key to access the value for.
Returns:
  Returns `null` if there is no such key or if it is not a `String`.

#### getString

    public String getString(String key,
                   String defaultValue)

Access a `String` value, returning a default value if it doesn't exist.

Parameters:
  `key` - The key to access the value for.
  `defaultValue` - The value to return if the key is not present or has the wrong type.
Returns:
  The default value if there is no such key or if it is not a `String`.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`