#include <coherence/lang/Class.hpp>
Inherits AnnotatedElement.
Inherited by AbstractTypedClass.
Not all managed classes may have a corresponding Class representation. Classes are referred to via their demangled RTTI name, for example coherence::lang::Object.
Classes can be loaded by name via a ClassLoader.
Public Types | ||||
typedef spec::Handle | Handle | |||
Class Handle definition. | ||||
typedef spec::View | View | |||
Class View definition. | ||||
typedef spec::Holder | Holder | |||
Class Holder definition. | ||||
Public Member Functions | ||||
virtual String::View | getName () const | |||
Return the name of the class. | ||||
virtual Object::Handle | newInstance (ObjectArray::View vaParam=NULL) const | |||
Create a new instance of the corresponding type. | ||||
virtual const std::type_info & | getTypeInfo () const =0 | |||
Return the typeinfo for the corresponding type. | ||||
virtual size32_t | getSize () const =0 | |||
Return the shallow size for an instance of the class represented by this Class. | ||||
virtual bool | isInstance (Object::View v) const =0 | |||
Return whether the passed in Object is an instance of class represented by this Class. | ||||
virtual bool | isAssignableFrom (Class::View vClass) const =0 | |||
Return true if the class represented by this object is the same Class or a super class or super interface of the specified class. | ||||
virtual Class::Handle | declare (Method::View vMethod) | |||
Register a method with this class. | ||||
virtual Method::View | getDeclaredMethod (String::View vsName, ObjectArray::View vaParams=NULL, int32_t nMod=0, bool fThrow=true) const | |||
Return the declared method of the specified name and parameters. | ||||
virtual ObjectArray::View | getDeclaredMethods () const | |||
Return an array containing all the Methods declared on this Class. | ||||
virtual Method::View | getMethod (String::View vsName, ObjectArray::View vaParams=NULL, int32_t nMod=0, bool fThrow=true) const | |||
Return the method of the specified name and parameters which is either declared or inherited by this class. | ||||
virtual ObjectArray::View | getMethods () const | |||
Return an array containing all the Methods declared on and inherited by this Class. | ||||
virtual Class::View | getSuperclass () const =0 | |||
Return the superclass of this class, or NULL if this class an interface or top level class. | ||||
virtual ObjectArray::View | getInterfaces () const =0 | |||
Return an array of Class::View objects representing the interfaces which the Class directly implements. | ||||
virtual Class::Handle | annotate (Annotation::View vAnnontation) | |||
Add the specified Annotation to the element. | ||||
virtual AnnotatedElement::View | getSuperelement () const | |||
Return the parent of this AnnotationElement or NULL if there is none. The default implementation always returns NULL.
| ||||
virtual bool | equals (Object::View that) const | |||
Return true iff the specified Object is "equal" to this Object. This method implements an equivalence relation on Objects:
The default implementation is a reference equality comparison.
| ||||
virtual size32_t | hashCode () const | |||
Return a hash code value for the Object. This method is supported for the benefit of hash-based containers.
The general contract of
The default implementation is identity based.
| ||||
Static Public Member Functions | ||||
static String::View | getClassName (Object::View v) | |||
Return the class name of the supplied Object. | ||||
static String::View | getTypeName (const std::type_info &info) | |||
Return the type name of the supplied Object. | ||||
Protected Member Functions | ||||
Class (const std::type_info &info) | ||||
Construct a class based on a C++ type_info. |
Class | ( | const std::type_info & | info | ) | [protected] |
Construct a class based on a C++ type_info.
info | the type_info for the class represented by this Class. |
virtual String::View getName | ( | ) | const [virtual] |
Return the name of the class.
virtual Object::Handle newInstance | ( | ObjectArray::View | vaParam = NULL |
) | const [virtual] |
Create a new instance of the corresponding type.
vaParam | the object's initialization parameters |
Reimplemented in TypedBarrenClass, and TypedClass.
virtual const std::type_info& getTypeInfo | ( | ) | const [pure virtual] |
Return the typeinfo for the corresponding type.
Implemented in AbstractTypedClass.
virtual size32_t getSize | ( | ) | const [pure virtual] |
Return the shallow size for an instance of the class represented by this Class.
Implemented in AbstractTypedClass.
virtual bool isInstance | ( | Object::View | v | ) | const [pure virtual] |
Return whether the passed in Object is an instance of class represented by this Class.
v | the object to test |
Implemented in AbstractTypedClass.
virtual bool isAssignableFrom | ( | Class::View | vClass | ) | const [pure virtual] |
Return true if the class represented by this object is the same Class or a super class or super interface of the specified class.
vClass | the class to test |
Implemented in AbstractTypedClass.
virtual Class::Handle declare | ( | Method::View | vMethod | ) | [virtual] |
Register a method with this class.
vMethod | the method to register |
virtual Method::View getDeclaredMethod | ( | String::View | vsName, | |
ObjectArray::View | vaParams = NULL , |
|||
int32_t | nMod = 0 , |
|||
bool | fThrow = true | |||
) | const [virtual] |
Return the declared method of the specified name and parameters.
The method is supplied with an array of either parameters or parameter types expressed as Class::View objects. If non-Class objects are provided then this method will search for a Method which can accept those parameters directly. If Class objects are provided then this method will search for a Method which takes the specified type, or a superclass.
vsName | the method name | |
vaParams | the method parameters or types | |
nMod | the modifiers to match | |
fThrow | false to return NULL rather then throw on failure |
NoSuchMethodException | if the method is not found and fThrow == true |
virtual ObjectArray::View getDeclaredMethods | ( | ) | const [virtual] |
Return an array containing all the Methods declared on this Class.
virtual Method::View getMethod | ( | String::View | vsName, | |
ObjectArray::View | vaParams = NULL , |
|||
int32_t | nMod = 0 , |
|||
bool | fThrow = true | |||
) | const [virtual] |
Return the method of the specified name and parameters which is either declared or inherited by this class.
The method is supplied with an array of either parameters or parameter types expressed as Class::View objects. If non-Class objects are provided then this method will search for a Method which can accept those parameters directly. If Class objects are provided then this method will search for a Method which takes the specified type, or a superclass.
vsName | the method name | |
vaParams | the method parameters or types | |
nMod | the modifiers to match | |
fThrow | false to return NULL rather then throw on failure |
NoSuchMethodException | if the method is not found and fThrow == true |
virtual ObjectArray::View getMethods | ( | ) | const [virtual] |
Return an array containing all the Methods declared on and inherited by this Class.
virtual Class::View getSuperclass | ( | ) | const [pure virtual] |
Return the superclass of this class, or NULL if this class an interface or top level class.
ClassNotFoundException | if the superclass is not registered |
Implemented in AbstractTypedClass.
virtual ObjectArray::View getInterfaces | ( | ) | const [pure virtual] |
Return an array of Class::View objects representing the interfaces which the Class directly implements.
Any interfaces not registered with the ClassLoader will be left out of the array.
Implemented in AbstractTypedClass.
virtual Class::Handle annotate | ( | Annotation::View | vAnnontation | ) | [virtual] |
Add the specified Annotation to the element.
vAnnontation | the annotation |
static String::View getClassName | ( | Object::View | v | ) | [static] |
static String::View getTypeName | ( | const std::type_info & | info | ) | [static] |
Return the type name of the supplied Object.
info | the type id for which to obtain the type name |