001    /*
002     * Copyright (c) 2005 Stephen J. McConnell
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.metro.tools;
020    
021    import java.io.IOException;
022    import java.beans.IntrospectionException;
023    
024    import net.dpml.metro.info.PartReference;
025    import net.dpml.metro.info.Type;
026    
027    /**
028     * The contract for builders that create component part.
029     *
030     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
031     * @version 1.2.0
032     */
033    public interface PartReferenceBuilder
034    {
035       /**
036        * Return the key identifying the part that this builder is building.
037        * @return the part key
038        */
039        String getKey();
040    
041       /**
042        * Build the part.
043        * @param classloader the classloader to use if type creation is required
044        * @param type the underlying part type
045        * @return th part reference
046        * @exception IntrospectionException if a class introspection error occurs
047        * @exception IOException if an I/O error occurs
048        * @exception ClassNotFoundException if a referenced class cannot be found
049        */
050        PartReference buildPartReference( ClassLoader classloader, Type type ) 
051           throws IntrospectionException, IOException, ClassNotFoundException;
052    }