patterntesting.runtime.experimental
Class ClassTester

Package class diagram package ClassTester
java.lang.Object
  extended by patterntesting.runtime.experimental.ClassTester

public final class ClassTester
extends Object

If you want to test some dependencies to a given class you can use this tester here.

Since:
1.1 (27.12.2010)
Author:
oliver

Constructor Summary
ClassTester(String classname)
          Instantiates a new class tester.
 
Method Summary
 boolean dependsOn(Class<?> otherClass)
          Checks if the stored class depends on another class.
 boolean dependsOn(String otherClassname)
          Checks if the stored class depends on another class.
static boolean dependsOn(String classname, Class<?> otherClass)
          Checks if the given class depends on another class.
 String getClassName()
          Gets the class name.
 Set<Class<?>> getDependencies()
          Gets the dependencies of the class name.
static Set<Class<?>> getDependenciesOf(String classname)
          Gets the dependencies of the given class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassTester

public ClassTester(String classname)
            throws ClassNotFoundException
Instantiates a new class tester.

Parameters:
classname - the classname
Throws:
ClassNotFoundException - the class not found exception
Method Detail

getClassName

public String getClassName()
Gets the class name.

Returns:
the class name

getDependencies

public Set<Class<?>> getDependencies()
Gets the dependencies of the class name. To get all dependencies we load all declared methods, fields and other stuff.

Returns:
the dependencies of

dependsOn

public boolean dependsOn(Class<?> otherClass)
Checks if the stored class depends on another class. Because the given otherClass is using probably another class loader we compare the class name to decide if it is loaded.

Parameters:
otherClass - the other class
Returns:
true, if successful

dependsOn

public boolean dependsOn(String otherClassname)
Checks if the stored class depends on another class.

Parameters:
otherClassname - the other classname
Returns:
true, if successful

getDependenciesOf

public static Set<Class<?>> getDependenciesOf(String classname)
                                       throws ClassNotFoundException
Gets the dependencies of the given class name.

Parameters:
classname - the classname
Returns:
the dependencies of
Throws:
ClassNotFoundException - the class not found exception

dependsOn

public static boolean dependsOn(String classname,
                                Class<?> otherClass)
                         throws ClassNotFoundException
Checks if the given class depends on another class.

Parameters:
classname - the classname
otherClass - the other class
Returns:
true, if successful
Throws:
ClassNotFoundException - the class not found exception


Copyright © 2002–2014 PatternTesting Team. All rights reserved.