Represents a Java class that may or may not be loaded in the VM. JClass is typically implemented in one of two ways: by wrapping a java.lang.Class or by parsing a source file directly with a tool such as javadoc or javelin.
If a JClass represents an inner class, its getParent() method returns the outer class. Otherwise, it returns the containing package.
Important Note: Because JAM's classloading machinery may swap instances of JClass out of memory at any time, you should never rely on instance equality (i.e., '==') when comparing two JClasses. To illustrate: it is possible (though rather unlikely) that that the following expression will evaluate to false
JMethod myJMethod = ... myJMethod.getReturnType() == myJMethod.getReturnType()
Instead, you should always use equals()
myJMethod.getReturnType().equals(myJMethod.getReturnType())
REVIEW a bunch of these methods (getMethods, getConstructors...) could throw SecurityException if the JClass is backed by java.lang.Class (see javadocs for Class). We're currently ignoring this, because it seems unlikely and it seems heavyweight. Seems ok?
@author Patrick Calahan <email: codehaus-at-bea-dot-com>