ReflWrap
Class ClassInfo

java.lang.Object
  extended by ReflWrap.ClassInfo

public class ClassInfo
extends java.lang.Object

Wrapper around java.lang.Class Retrieve information about classes at runtime.


Field Summary
private  java.lang.String fqcn
          Fully qualified name of the class
private  java.lang.Class klasse
          The underlying class
private  java.lang.reflect.Method[] m
          Methods in original order
private  java.lang.reflect.Method[] m_ord
          Methods in correct order according to the interface definition
private  java.lang.String name
          Prettified name of the class
 
Constructor Summary
ClassInfo(java.lang.Class klasse)
          Constructor from an available Class object
ClassInfo(java.lang.String FQCN)
          Constructor from a fully-qualified classname.
 
Method Summary
 java.lang.Class _class()
          Get the underlying Class object
 java.lang.String _package()
          Get the name of the package this class is part of
 java.lang.Class arrayType()
          Retrieve the base type of an array
 java.lang.String clstr()
          Retrieve a String of the code to generate a new object of this class.
static java.lang.String cncs2java(java.lang.String name)
           
 java.lang.reflect.Constructor[] constructors()
          Get all constructors for this class
static void dumpMethods(java.lang.Class klasse)
          Debugging method which prints all declared methods to the screen
 boolean equals(java.lang.Object data)
          Compare ClassInfo objects
 java.lang.reflect.Field[] fields()
          Get the members of this class
 java.lang.String filename()
          Get the filename of this class
 java.lang.String fqcn()
          Get the fully-qualified classname of this class
 java.lang.String fqcncs()
          Get the fully-qualified classname in C++ notation
 java.lang.String fqsuperclass()
          Get the fully-qualified name of this class' superclass
 boolean hasMethod(java.lang.String name)
          Check whether a certain method was declared in this class
 boolean implementing(java.lang.String klass)
          Check if a certain interface is implemented by this class
 java.lang.Class[] interfaces()
          Get all interfaces which are implemented by this class
<C extends java.lang.Class<? extends java.lang.annotation.Annotation>>
boolean
isAnot(C klass)
          Checks if a certain Annotation is present
 boolean isArray()
          Check whether or not this Class is an array type
 java.lang.reflect.Method[] meth_here()
          Get only the methods which are declared in this class
 java.util.LinkedList<java.lang.String> methodList()
          Debugging helper
 java.lang.reflect.Method[] methods()
          Get the all methods this class provides
 java.lang.String name()
          Get the simple name of the class
private static java.lang.reflect.Method[] orderMethods(java.lang.reflect.Method[] old_m)
          Orders methods according to static FunctionIDs (FIDs)
 java.lang.Class sclass()
          Get the class object of the superclass
 java.lang.String superclass()
          Get the name of this class' superclass
 java.lang.String toString()
          Get a string representation of this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

klasse

private java.lang.Class klasse
The underlying class


name

private java.lang.String name
Prettified name of the class


fqcn

private java.lang.String fqcn
Fully qualified name of the class


m

private java.lang.reflect.Method[] m
Methods in original order


m_ord

private java.lang.reflect.Method[] m_ord
Methods in correct order according to the interface definition

Constructor Detail

ClassInfo

public ClassInfo(java.lang.String FQCN)
          throws java.lang.ClassNotFoundException
Constructor from a fully-qualified classname.

Parameters:
FQCN - fully-qualified classname
Throws:
java.lang.ClassNotFoundException

ClassInfo

public ClassInfo(java.lang.Class klasse)
Constructor from an available Class object

Parameters:
klasse - Class object
Method Detail

orderMethods

private static java.lang.reflect.Method[] orderMethods(java.lang.reflect.Method[] old_m)
Orders methods according to static FunctionIDs (FIDs)

Parameters:
old_m - Array of all available methods in this class
Returns:
Sorted array of methods

isAnot

public <C extends java.lang.Class<? extends java.lang.annotation.Annotation>> boolean isAnot(C klass)
Checks if a certain Annotation is present

Parameters:
klass - Requested Annotation
Returns:
True if the Annotation is present, false if it is not.

fqcn

public java.lang.String fqcn()
Get the fully-qualified classname of this class

Returns:
Fully-qualified classname

fqcncs

public java.lang.String fqcncs()
Get the fully-qualified classname in C++ notation

Returns:
Fully-qualified classname

cncs2java

public static java.lang.String cncs2java(java.lang.String name)

filename

public java.lang.String filename()
Get the filename of this class

Returns:
Filename

_package

public java.lang.String _package()
Get the name of the package this class is part of

Returns:
Package name

name

public java.lang.String name()
Get the simple name of the class

Returns:
Class name

_class

public java.lang.Class _class()
Get the underlying Class object

Returns:
Class object

methods

public java.lang.reflect.Method[] methods()
Get the all methods this class provides

Returns:
Array of methods

meth_here

public java.lang.reflect.Method[] meth_here()
Get only the methods which are declared in this class

Returns:
Array of methods

constructors

public java.lang.reflect.Constructor[] constructors()
Get all constructors for this class

Returns:
Array of constructors

interfaces

public java.lang.Class[] interfaces()
Get all interfaces which are implemented by this class

Returns:
Array of classes

implementing

public boolean implementing(java.lang.String klass)
Check if a certain interface is implemented by this class

Parameters:
klass - Fully-qualified classname of the interface
Returns:
True if it is implemented by this class, false if it is not.

superclass

public java.lang.String superclass()
Get the name of this class' superclass

Returns:
Name of the superclass

fqsuperclass

public java.lang.String fqsuperclass()
Get the fully-qualified name of this class' superclass

Returns:
Fully-qualified name of the superclass

sclass

public java.lang.Class sclass()
Get the class object of the superclass

Returns:
Class object of the superclass

toString

public java.lang.String toString()
Get a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

fields

public java.lang.reflect.Field[] fields()
Get the members of this class

Returns:
Array of fields

dumpMethods

public static void dumpMethods(java.lang.Class klasse)
Debugging method which prints all declared methods to the screen

Parameters:
klasse - Requested class

arrayType

public java.lang.Class arrayType()
Retrieve the base type of an array

Returns:
Base type or null if this class is not an array

clstr

public java.lang.String clstr()
Retrieve a String of the code to generate a new object of this class.

Returns:
Code

equals

public boolean equals(java.lang.Object data)
Compare ClassInfo objects

Overrides:
equals in class java.lang.Object
Parameters:
data - ClassInfo object
Returns:
True if equal, false if not.

isArray

public boolean isArray()
Check whether or not this Class is an array type

Returns:
True if yes, false otherwise.

methodList

public java.util.LinkedList<java.lang.String> methodList()
Debugging helper

Returns:
List of methods declared in this class

hasMethod

public boolean hasMethod(java.lang.String name)
Check whether a certain method was declared in this class

Parameters:
name - Name of the method
Returns:
True if it exists, false otherwise