001// Copyright 2008 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.ioc.internal.services;
016
017import javassist.CtClass;
018
019/**
020 * Used when generating new classes on the fly.
021 *
022 * @see org.apache.tapestry5.ioc.services.ClassFactory
023 */
024public interface CtClassSource
025{
026    /**
027     * Returns the number of classes created.
028     */
029    int getCreatedClassCount();
030
031    /**
032     * Converts an existing class to a CtClass instance.
033     */
034    CtClass toCtClass(Class searchClass);
035
036    /**
037     * Converts a class name to a CtClass instance.
038     */
039    CtClass toCtClass(String name);
040
041    /**
042     * Createa a new CtClass instance.
043     */
044    CtClass newClass(String name, Class superClass);
045
046    /**
047     * Used after constructing the CtClass fully, to convert it into a Class ready to be instantiated.
048     */
049    Class createClass(CtClass ctClass);
050}