com.sdm.quasar.client.core.common.util
Class DefaultClassUtilitiesImplementation

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.util.DefaultClassUtilitiesImplementation
All Implemented Interfaces:
ClassUtilities.ClassUtilitiesImplementation

public class DefaultClassUtilitiesImplementation
extends java.lang.Object
implements ClassUtilities.ClassUtilitiesImplementation

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
DefaultClassUtilitiesImplementation()
          Creates a new DefaultClassUtilitiesImplementation.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassUtilitiesImplementation

public DefaultClassUtilitiesImplementation()
Creates a new DefaultClassUtilitiesImplementation.

Method Detail

fileExistsInClassPath

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

Specified by:
fileExistsInClassPath in interface ClassUtilities.ClassUtilitiesImplementation
Parameters:
filename - the filename
Returns:
true, iff the file is accessible
See Also:
ClassUtilities.ClassUtilitiesImplementation.fileExistsInClassPath(java.lang.String)

getClassForName

public java.lang.Class getClassForName(java.lang.String classname)
Description copied from interface: ClassUtilities.ClassUtilitiesImplementation
Creates a Class for the class name specified.

Specified by:
getClassForName in interface ClassUtilities.ClassUtilitiesImplementation
Parameters:
classname - the full qualified class name (not null)
Returns:
the Class object for the class name given
See Also:
ClassUtilities.ClassUtilitiesImplementation.getClassForName(java.lang.String)

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String resourcename)
Description copied from interface: ClassUtilities.ClassUtilitiesImplementation
Returns the resource with the given name as InputStream.

Specified by:
getResourceAsStream in interface ClassUtilities.ClassUtilitiesImplementation
Parameters:
resourcename - the resource name
Returns:
the InputStream for the resource
See Also:
ClassUtilities.ClassUtilitiesImplementation.getResourceAsStream(java.lang.String)

newInstance

public java.lang.Object newInstance(java.lang.Class cls)
Description copied from interface: ClassUtilities.ClassUtilitiesImplementation
Creates a new instance for the class given. Normally should do something equal to Class.newInstance().

Specified by:
newInstance in interface ClassUtilities.ClassUtilitiesImplementation
Parameters:
cls - the class to create an instance of (not null)
Returns:
the new created instance of cls
See Also:
ClassUtilities.ClassUtilitiesImplementation.newInstance(java.lang.Class)

isClassAssignableFrom

public boolean isClassAssignableFrom(java.lang.Class superClassCandidate,
                                     java.lang.Class subClassCandidate)
Description copied from interface: ClassUtilities.ClassUtilitiesImplementation
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)

Specified by:
isClassAssignableFrom in interface ClassUtilities.ClassUtilitiesImplementation
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
See Also:
ClassUtilities.ClassUtilitiesImplementation.isClassAssignableFrom(java.lang.Class, java.lang.Class)