public class Context extends Object
Constructor and Description |
---|
Context() |
Context(Map<String,String> paramters) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from this map.
|
boolean |
containsKey(String key)
Returns true if this Context contains a mapping for key.
|
Boolean |
getBoolean(String key)
Gets value mapped to key, returning null if unmapped.
|
Boolean |
getBoolean(String key,
Boolean defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Double |
getDouble(String key)
Gets value mapped to key, returning null if unmapped.
|
Double |
getDouble(String key,
Double defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Float |
getFloat(String key)
Gets value mapped to key, returning null if unmapped.
|
Float |
getFloat(String key,
Float defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Integer |
getInteger(String key)
Gets value mapped to key, returning null if unmapped.
|
Integer |
getInteger(String key,
Integer defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Long |
getLong(String key)
Gets value mapped to key, returning null if unmapped.
|
Long |
getLong(String key,
Long defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Map<String,String> |
getParameters()
Gets a copy of the backing map structure.
|
String |
getString(String key)
Gets value mapped to key, returning null if unmapped.
|
String |
getString(String key,
String defaultValue)
Gets value mapped to key, returning defaultValue if unmapped.
|
Map<String,String> |
getSubProperties(String prefix)
Get properties which start with a prefix.
|
void |
put(String key,
String value)
Associates the specified value with the specified key in this context.
|
void |
putAll(Map<String,String> map)
Associates all of the given map's keys and values in the Context.
|
String |
toString() |
public Map<String,String> getParameters()
public void clear()
public Map<String,String> getSubProperties(String prefix)
{ hdfs.key = value, otherKey = otherValue }
this method will return a map containing:
{ key = value}
Note: The prefix must end with a period character. If not
this method will raise an IllegalArgumentException.prefix
- key prefix to find and remove from keys in resulting mapIllegalArguemntException
- if the given prefix does not end with
a period character.public void putAll(Map<String,String> map)
public void put(String key, String value)
key
- key with which the specified value is to be associatedvalue
- to be associated with the specified keypublic boolean containsKey(String key)
public Boolean getBoolean(String key, Boolean defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic Boolean getBoolean(String key)
Note that this method returns an object as opposed to a
primitive. The configuration key requested may not be mapped
to a value and by returning the primitive object wrapper we can
return null. If the key does not exist the return value of
this method is assigned directly to a primitive, a
NullPointerException
will be thrown.
key
- to be foundpublic Integer getInteger(String key, Integer defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic Integer getInteger(String key)
Note that this method returns an object as opposed to a
primitive. The configuration key requested may not be mapped
to a value and by returning the primitive object wrapper we can
return null. If the key does not exist the return value of
this method is assigned directly to a primitive, a
NullPointerException
will be thrown.
key
- to be foundpublic Long getLong(String key, Long defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic Long getLong(String key)
Note that this method returns an object as opposed to a
primitive. The configuration key requested may not be mapped
to a value and by returning the primitive object wrapper we can
return null. If the key does not exist the return value of
this method is assigned directly to a primitive, a
NullPointerException
will be thrown.
key
- to be foundpublic String getString(String key, String defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic String getString(String key)
key
- to be foundpublic Float getFloat(String key, Float defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic Float getFloat(String key)
Note that this method returns an object as opposed to a
primitive. The configuration key requested may not be mapped
to a value and by returning the primitive object wrapper we can
return null. If the key does not exist the return value of
this method is assigned directly to a primitive, a
NullPointerException
will be thrown.
key
- to be foundpublic Double getDouble(String key, Double defaultValue)
key
- to be founddefaultValue
- returned if key is unmappedpublic Double getDouble(String key)
Note that this method returns an object as opposed to a
primitive. The configuration key requested may not be mapped
to a value and by returning the primitive object wrapper we can
return null. If the key does not exist the return value of
this method is assigned directly to a primitive, a
NullPointerException
will be thrown.
key
- to be foundCopyright © 2009–2019 Apache Software Foundation. All rights reserved.