edu.stanford.nlp.util
Class ReflectionLoading

java.lang.Object
  extended by edu.stanford.nlp.util.ReflectionLoading

public class ReflectionLoading
extends java.lang.Object

The goal of this class is to make it easier to load stuff by reflection. You can hide all of the ugly exception catching, etc by using the static methods in this class.

Author:
John Bauer, Gabor Angeli (changed)

Nested Class Summary
static class ReflectionLoading.ReflectionLoadingException
          This class encapsulates all of the exceptions that can be thrown when loading something by reflection.
 
Method Summary
static
<T> T
loadByReflection(java.lang.String className, java.lang.Object... arguments)
          You can use this as follows:
String s = ReflectionLoading.loadByReflection("java.lang.String", "foo");
String s = ReflectionLoading.loadByReflection("java.lang.String");
Note that this uses generics for convenience, but this does nothing for compile-time error checking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadByReflection

public static <T> T loadByReflection(java.lang.String className,
                                     java.lang.Object... arguments)
You can use this as follows:
String s = ReflectionLoading.loadByReflection("java.lang.String", "foo");
String s = ReflectionLoading.loadByReflection("java.lang.String");
Note that this uses generics for convenience, but this does nothing for compile-time error checking. You can do
Integer i = ReflectionLoading.loadByReflection("java.lang.String");
and it will compile just fine, but will result in a ClassCastException.



Stanford NLP Group