Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/lang/ClassLoader.hpp

    00001 /*
    00002 * ClassLoader.hpp
    00003 *
    00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    00005 *
    00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
    00007 * affiliates.
    00008 *
    00009 * This software is the confidential and proprietary information of Oracle
    00010 * Corporation. You shall not disclose such confidential and proprietary
    00011 * information and shall use it only in accordance with the terms of the
    00012 * license agreement you entered into with Oracle.
    00013 *
    00014 * This notice may not be removed or altered.
    00015 */
    00016 #ifndef COH_CLASS_LOADER_HPP
    00017 #define COH_CLASS_LOADER_HPP
    00018
    00019 #include "coherence/lang/compatibility.hpp"
    00020
    00021 #include "coherence/lang/interface_spec.hpp"
    00022 #include "coherence/lang/Class.hpp"
    00023 #include "coherence/lang/Object.hpp"
    00024 #include "coherence/lang/String.hpp"
    00025
    00026 #include <typeinfo>
    00027
    00028 COH_OPEN_NAMESPACE2(coherence,lang)
    00029
    00030
    00031 /**
    00032 * ClassLoader provides a mechanism for obtaining a Class object.  Classes
    00033 * may be manually registered with a loader, or the loader may search out
    00034 * classes using custom search and load mechanisms.
    00035 *
    00036 * Not all classes are required to have a corresponding Class representation.
    00037 *
    00038 * The simplest way to enable a Class to be looked up by name, is to register
    00039 * it with the system ClassLoader, which can be obtained by calling
    00040 * ClassLoader::getSystemClassLoader().  For classes which include a no
    00041 * parameter static create method, a utility macro can be used to generate
    00042 * and register a Class automatically.  For example, given the class Foo:
    00043 *
    00044 * COH_REGISTER_TYPED_CLASS(Foo)
    00045 *
    00046 * Will register a Class for Foo. This registration would normally occur in
    00047 * Foo.cpp, outside of any method.
    00048 *
    00049 * @author mf  2008.04.02
    00050 */
    00051 class COH_EXPORT ClassLoader
    00052     : public interface_spec<ClassLoader>
    00053     {
    00054     // ----- ClassLoader interface ------------------------------------------
    00055
    00056     public:
    00057         /**
    00058         * Loads the class for the specified name.
    00059         *
    00060         * @param vsName  the fully qualified name of the desired class
    00061         *
    00062         * @return the resulting {@link Class} object
    00063         *
    00064         * @throws ClassNotFoundException if the class was not found
    00065         */
    00066         virtual Class::View loadByName(String::View vsName) const = 0;
    00067
    00068         /**
    00069         * Loads the class for the specified RTTI typeid.
    00070         *
    00071         * @param info  the class's type_info
    00072         *
    00073         * @return the resulting {@link Class} object
    00074         *
    00075         * @throws ClassNotFoundException if the class was not found
    00076         */
    00077         virtual Class::View loadByType(const std::type_info& info) const = 0;
    00078
    00079         /**
    00080         * Returns the parent class loader for delegation.
    00081         *
    00082         * @return the parent class loader for delegation; NULL indicates the
    00083         *         system ClassLoader has been reached
    00084         */
    00085         virtual ClassLoader::Handle getParent() const = 0;
    00086     };
    00087
    00088 COH_CLOSE_NAMESPACE2
    00089
    00090 #endif // COH_CLASS_LOADER_HPP

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.