#include <coherence/lang/ClassLoader.hpp>
Inherits Object.
Inherited by SystemClassLoader [virtual]
.
Classes may be manually registered with a loader, or the loader may search out classes using custom search and load mechanisms.
Not all classes are required to have a corresponding Class representation.
The simplest way to enable a Class to be looked up by name, is to register it with the system ClassLoader, which can be obtained by calling ClassLoader::getSystemClassLoader(). For classes which include a no parameter static create method, a utility macro can be used to generate and register a Class automatically. For example, given the class Foo:
COH_REGISTER_TYPED_CLASS(Foo)
Will register a Class for Foo. This registration would normally occur in Foo.cpp, outside of any method.
Public Types | |
typedef spec::Handle | Handle |
ClassLoader Handle definition. | |
typedef spec::View | View |
ClassLoader View definition. | |
typedef spec::Holder | Holder |
ClassLoader Holder definition. | |
Public Member Functions | |
virtual Class::View | loadByName (String::View vsName) const =0 |
Loads the class for the specified name. | |
virtual Class::View | loadByType (const std::type_info &info) const =0 |
Loads the class for the specified RTTI typeid. | |
virtual ClassLoader::Handle | getParent () const =0 |
Returns the parent class loader for delegation. |
virtual Class::View loadByName | ( | String::View | vsName | ) | const [pure virtual] |
Loads the class for the specified name.
vsName | the fully qualified name of the desired class |
ClassNotFoundException | if the class was not found |
Implemented in SystemClassLoader.
virtual Class::View loadByType | ( | const std::type_info & | info | ) | const [pure virtual] |
Loads the class for the specified RTTI typeid.
info | the class's type_info |
ClassNotFoundException | if the class was not found |
Implemented in SystemClassLoader.
virtual ClassLoader::Handle getParent | ( | ) | const [pure virtual] |
Returns the parent class loader for delegation.
Implemented in SystemClassLoader.