|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.Tools
public class Tools
| Constructor Summary | |
|---|---|
Tools()
|
|
| Method Summary | |
|---|---|
static List |
findSubclasses(Class parentClass)
Finds all subclasses of a given class or interface. |
static Long |
gensym()
Returns a Long wich is unique during the current run. |
static Long |
genTime()
|
static Constructor |
getMostSpecificConstructor(Class targetClass,
Class paramClass)
Find the constructor to use to create an instance of targetClass from one of paramClass. |
static boolean |
isUnicodeEnabled()
Checks wheter Gate is Unicode enabled |
static void |
printStackTrace(PrintStream pStream)
Prints the stack trace of the current thread to the specified print stream. |
static void |
setUnicodeEnabled(boolean value)
Specifies whether Gate should or shouldn't know about Unicode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Tools()
| Method Detail |
|---|
public static Long gensym()
public static Long genTime()
public static void setUnicodeEnabled(boolean value)
public static boolean isUnicodeEnabled()
public static List findSubclasses(Class parentClass)
parentClass - the class for which subclasses are sought
Class objects.
public static Constructor getMostSpecificConstructor(Class targetClass,
Class paramClass)
throws NoSuchMethodException
Find the constructor to use to create an instance of
targetClass from one of paramClass.
We use the same rules as Java in finding the constructor
to call, i.e. we find the constructor that javac would call for
the expression
parameterValue = new PropertyType(parameterValue):
T1 is assignable from
paramTypeT2
is more specific than the argument type S of every
other one i.e.
for all S, S.isAssignableFrom(T2)If there is no applicable single argument constructor that is
more specific than all the others, then the above expression
would be a compile error (constructor ParamType(X) is
ambiguous).
(The "most specific" check is to catch situations such as
paramClass implements SortedSet,
targetClass = TreeSet. Here both
TreeSet(SortedSet) and TreeSet(Collection)
are applicable but the former is more specific. However, if
paramType also implements Comparator then there are
three applicable constructors, taking SortedSet,
Collection and Comparator respectively
and none of these types is assignable to both the others. This
is ambiguous according to the Java Language Specification,
2nd edition, section 15.12.2)
targetClass - the class we wish to constructparamClass - the type of the object to pass as a parameter to
the constructor.
targetClass
that is applicable to an argument of paramClass
NoSuchMethodException - if there are no applicable constructors,
or if there is no single most-specific one.public static final void printStackTrace(PrintStream pStream)
pStream -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||