net.sf.zig_project.gpl.common
Class VersionScanner

java.lang.Object
  extended bynet.sf.zig_project.gpl.common.VersionScanner

public abstract class VersionScanner
extends Object

Version Scanner provides a library of functions which can discover information relating to the availability of a class or method. Generally speaking, considering a class as available means that the class loader was able to locate, and usually resolve, the class and all dependant classes without error.

Methods in this class are generally called from a static constructor, for example:

 public class SomeClass {
	public static final boolean USE_OTHER_CLASS=VersionScanner.classAvailable("SomePackage.SomeOtherClass");
	public void foo() { if (USE_OTHER_CLASS) SomeOtherClass.bar(); }
 }
In this example, SomeClass is aware of the existance of SomeOtherClass and always has an opportunity to execute without throwing an error, provided that dependant sections of code are properly nested within an if check. Notice that class names must be written in their fully qualified form.

Version:
September 14, 2004
Author:
Frank Ziglar

Constructor Summary
VersionScanner()
           
 
Method Summary
static Class[] asClassArray(String[] nclasses)
           
static boolean classAvailable(String name)
           
static boolean methodAvailable(Class cls, String nmtd)
           
static boolean methodAvailable(Class cls, String nmtd, Class[] params)
           
static boolean methodAvailable(Class cls, String nmtd, String[] params)
           
static boolean methodAvailable(String ncls, String nmtd)
           
static boolean methodAvailable(String ncls, String nmtd, Class[] params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionScanner

public VersionScanner()
Method Detail

classAvailable

public static boolean classAvailable(String name)

methodAvailable

public static boolean methodAvailable(String ncls,
                                      String nmtd,
                                      Class[] params)

methodAvailable

public static boolean methodAvailable(Class cls,
                                      String nmtd,
                                      Class[] params)

asClassArray

public static Class[] asClassArray(String[] nclasses)
                            throws ClassNotFoundException
Throws:
ClassNotFoundException

methodAvailable

public static boolean methodAvailable(Class cls,
                                      String nmtd,
                                      String[] params)

methodAvailable

public static boolean methodAvailable(Class cls,
                                      String nmtd)

methodAvailable

public static boolean methodAvailable(String ncls,
                                      String nmtd)