Java Utililty Methods Dictionary Usage

List of utility methods to do Dictionary Usage

  1. HOME
  2. Java
  3. D
  4. Dictionary Usage

Description

The list of methods to do Dictionary Usage are organized into topic(s).

Method

void addReferenceIdsToServiceProperties(String prefix, Map referenceProps, Dictionary serviceProps)
add Reference Ids To Service Properties
Object serviceId = referenceProps.get("service.id");
if (serviceId != null) {
 serviceProps.put(prefix + ".service.id", serviceId);
Object servicedPid = referenceProps.get("service.pid");
if (servicedPid != null) {
 serviceProps.put(prefix + ".service.pid", servicedPid);
boolean containsKey(Dictionary dict, String key)
contains Key
if (dict == null || key == null) {
 return false;
return dict.get(key) != null;
Boolean getBoolean(Dictionary p, Object key, Boolean defaultValue)
get Boolean
Object value = p.get(key);
if (value == null)
 return defaultValue;
if (value instanceof Boolean)
 return (Boolean) value;
String s = value.toString().toLowerCase().trim();
if (s.equals("true") || s.equals("yes"))
 return new Boolean(true);
...
String getSpringContextHeader(Dictionary headers)
Return the #SPRING_CONTEXT_HEADER if present from the given dictionary.
Object header = null;
if (headers != null)
 header = headers.get(SPRING_CONTEXT_HEADER);
return (header != null ? header.toString().trim() : null);
Boolean getState(Dictionary conf, String property)
Getter for the state of a boolean type property.
Object value = conf.get(property);
if (value instanceof String) {
 String strVal = ((String) value).trim();
 if ("0".equals(strVal)) {
 return false;
 } else if ("1".equals(strVal)) {
 return true;
 } else {
...
String getString(Dictionary p, Object key, String defaultValue)
get String
Object value = p.get(key);
if (value == null)
 return defaultValue;
else
 return value.toString();
boolean isNullOrNothing(final Object[] array)
is Null Or Nothing
return array == null || array.length == 0;
void parseRequestOption(Dictionary conf, String confParam, Map requestOptions)
Parses a request option from the configuration parameters.
Boolean state = getState(conf, confParam);
if (state != null) {
 String reqParam = confParam.substring(3); 
 requestOptions.put(reqParam, state);
void setDefault(Dictionary dict, String key, String value)
Puts the given key-value pair in the given dictionary if the key does not already exist in it or if its existing value is null.
if (dict.get(key) == null) {
 dict.put(key, value);
void setProperty(Dictionary properties, String key, String value)
set Property
if (value != null) {
 properties.put(key, value);


AltStyle によって変換されたページ (->オリジナル) /