com.sdm.quasar.client.core.common.util
Interface ClassUtilities.ClassUtilitiesImplementation

All Known Implementing Classes:
DefaultClassUtilitiesImplementation
Enclosing interface:
ClassUtilities

public static interface ClassUtilities.ClassUtilitiesImplementation

This is the interface that implementors must implement.


Method Summary
 boolean fileExistsInClassPath(java.lang.String filename)
          Tests, whether a file is accessible in the class path using the ClassLoader.getResourceAsStream(java.lang.String) method of the current thread class loader.
 java.lang.Class getClassForName(java.lang.String classname)
          Creates a Class for the class name specified.
 java.io.InputStream getResourceAsStream(java.lang.String resourcename)
          Returns the resource with the given name as InputStream.
 boolean isClassAssignableFrom(java.lang.Class superClassCandidate, java.lang.Class subClassCandidate)
          Checks, if the given superClassCandidate class is the same or a superclass or superinterface of the subClassCandidate class.
 java.lang.Object newInstance(java.lang.Class cls)
          Creates a new instance for the class given.
 

Method Detail

fileExistsInClassPath

public boolean fileExistsInClassPath(java.lang.String filename)
Tests, whether a file is accessible in the class path using the ClassLoader.getResourceAsStream(java.lang.String) method of the current thread class loader.

Parameters:
filename - the filename
Returns:
true, iff the file is accessible

getClassForName

public java.lang.Class getClassForName(java.lang.String classname)
Creates a Class for the class name specified.

Parameters:
classname - the full qualified class name (not null)
Returns:
the Class object for the class name given
Throws:
java.lang.IllegalArgumentException - if the class with that name could not be found or if the class name is null

newInstance

public java.lang.Object newInstance(java.lang.Class cls)
Creates a new instance for the class given. Normally should do something equal to Class.newInstance().

Parameters:
cls - the class to create an instance of (not null)
Returns:
the new created instance of cls
Throws:
java.lang.IllegalArgumentException - if no instance could be created of the given class or if the given class is null

isClassAssignableFrom

public boolean isClassAssignableFrom(java.lang.Class superClassCandidate,
                                     java.lang.Class subClassCandidate)
Checks, if the given superClassCandidate class is the same or a superclass or superinterface of the subClassCandidate class. This method should work according to Class.isAssignableFrom(Class)

Parameters:
superClassCandidate - the super class or interface candidate to check (not null)
subClassCandidate - the sub class or interface candidate to check (not null)
Returns:
true if superClassCandidate is the same or a super class or super interface of subClassCandidate

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String resourcename)
Returns the resource with the given name as InputStream.

Parameters:
resourcename - the resource name
Returns:
the InputStream for the resource