de.fhg.igd.semoa.util
Class Lookup

java.lang.Object
  extended byde.fhg.igd.semoa.util.Lookup

public class Lookup
extends Object

This convenience class performs additional checks on frequently required lookup tasks.

Version:
"$Id: Lookup.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Matthias Pressfreund

Constructor Summary
private Lookup()
          Disabled construction.
 
Method Summary
static Object environment(String key, Class clazz)
          Perform Environment.lookup(String) with the given key as parameter.
static Object environmentWhatIs(String whatisKey, Class clazz)
          Subsequently call whatIs(String) and environment(String,Class).
static String whatIs(String key)
          Call WhatIs.stringValue(String), raise an IllegalArgumentException in case the given key is not defined and the return value would be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lookup

private Lookup()
Disabled construction.

Method Detail

whatIs

public static String whatIs(String key)
Call WhatIs.stringValue(String), raise an IllegalArgumentException in case the given key is not defined and the return value would be null.

Parameters:
key - The WhatIs key
Returns:
The corresponding WhatIs value
Throws:
IllegalArgumentException - if the given key is not defined

environment

public static Object environment(String key,
                                 Class clazz)
Perform Environment.lookup(String) with the given key as parameter. The type of the result must be an instance of the given class, or null will be returned otherwise.

Parameters:
key - The lookup key
clazz - The expected type of the lookup result
Returns:
The lookup result if it is an instance of the given Class, null otherwise

environmentWhatIs

public static Object environmentWhatIs(String whatisKey,
                                       Class clazz)
Subsequently call whatIs(String) and environment(String,Class).



Copyright © Fraunhofer Gesellschaft. All Rights Reserved.