001/* Get the classes for different types of model elements.
002
003   Copyright (c) 2015-2016 The Regents of the University of California; iSencia Belgium NV.
004   All rights reserved.
005
006   Permission is hereby granted, without written agreement and without
007   license or royalty fees, to use, copy, modify, and distribute this
008   software and its documentation for any purpose, provided that the above
009   copyright notice and the following two paragraphs appear in all copies
010   of this software.
011
012   IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA LIABLE TO ANY PARTY
013   FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
014   ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
015   THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
016   SUCH DAMAGE.
017
018   THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
019   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
021   PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
022   CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
023   ENHANCEMENTS, OR MODIFICATIONS.
024
025   PT_COPYRIGHT_VERSION_2
026   COPYRIGHTENDKEY
027*/
028
029package org.ptolemy.classloading;
030
031import org.ptolemy.commons.VersionSpecification;
032
033import ptolemy.kernel.util.NamedObj;
034
035/**
036 * Get the classes for different types of model elements.
037 * <p>
038 * Most important cases are actors and directors.
039 * But also dedicated port or parameter classes can be offered via implementations of this interface.
040 * </p>
041 *
042 * @author ErwinDL
043 * @version $Id$
044 * @since Ptolemy II 11.0
045 * @Pt.ProposedRating Yellow (ErwinDL)
046 * @Pt.AcceptedRating Yellow (ErwinDL)
047 */
048public interface ModelElementClassProvider {
049
050    /**
051     * Return the requested class for the requested version (if specified).
052     * If this provider doesn't have this class available, it should throw a <code>ClassNotFoundException</code>.
053     * (Optionally, it could also just return null, for those dvp-ers who don't like exceptions. ;-) )
054     *
055     * @param className typically a fully qualified Java class name. Mandatory non-null.
056     * @param versionSpec optional constraint on desired version for the class that must be provided. If null, no version constraint is imposed.
057     * @return the concrete class of the <code>NamedObj</code> matching the given className.
058     * @exception ClassNotFoundException if this provider can not provide the requested class for the requested version (if specified)
059     *
060     * @see VersionSpecification
061     */
062    Class<? extends NamedObj> getClass(String className,
063            VersionSpecification versionSpec) throws ClassNotFoundException;
064}