001    /*
002     * ============================================================================
003     * GNU Lesser General Public License
004     * ============================================================================
005     *
006     * Beanlet - JSE Application Container.
007     * Copyright (C) 2006  Leon van Zantvoort
008     * 
009     * This library is free software; you can redistribute it and/or
010     * modify it under the terms of the GNU Lesser General Public
011     * License as published by the Free Software Foundation; either
012     * version 2.1 of the License, or (at your option) any later version.
013     * 
014     * This library is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017     * Lesser General Public License for more details.
018     * 
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this library; if not, write to the Free Software
021     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
022     * 
023     * Leon van Zantvoort
024     * 243 Acalanes Drive #11
025     * Sunnyvale, CA 94086
026     * USA
027     *
028     * zantvoort@users.sourceforge.net
029     * http://beanlet.org
030     */
031    package org.beanlet;
032    
033    import java.util.List;
034    
035    /**
036     * Provides information on the beanlet definition.
037     *
038     * @param <T> the beanlet type.
039     * @author Leon van Zantvoort
040     */
041    public interface BeanletMetaData<T> extends MetaData {
042    
043        /**
044         * Returns canonical name of the beanlet.
045         *
046         * @return canonical name of the beanlet.
047         */
048        String getBeanletName();
049        
050        /**
051         * Returns the beanlet type. This can either be a class or
052         * an interface.
053         *
054         * @return beanlet type.
055         */
056        Class<T> getType();
057        
058        /**
059         * Returns the classloader associated with the deployment of this beanlet.
060         * This is not necessarily the classloader that loaded the beanlet type.
061         *
062         * @return classloader associated with this beanlet.
063         */
064        ClassLoader getClassLoader();
065        
066        /** 
067         * <p>Returns a list of additional interfaces that are exposed by this 
068         * beanlet.</p>
069         *
070         * <p>Note that this list is empty for non-proxy beanlets.</p>
071         *
072         * @return list of interfaces exposed by beanlet.
073         */
074        List<Class<?>> getInterfaces();
075    
076        /**
077         * <p>Returns {@code true} if this is a proxy beanlet, {@code false}
078         * otherwise.</p>
079         * 
080         * <p>Proxy beanlets have the ability to expose interfaces that are not 
081         * implemented by the type. These interfaces are returned by
082         * {@code getInterfaces}. Furthermore, proxy beanlets allow method 
083         * calls to be intercepted by beanlet interceptors.</p>
084         * 
085         * @return {@code true} if this is a proxy beanlet.
086         */
087        boolean isProxy();
088        
089        /**
090         * <p>Returns {@code true} if this is a vanilla beanlet, {@code false} 
091         * otherwise.</p>
092         *
093         * <p>Vanilla beanlets directly expose their beanlet instances and thus
094         * their type, as specified by {@code getType}. Proxy vanilla
095         * beanlets are implemented by dynamically subclassing the type 
096         * adding the proxying logic.</p>
097         *
098         * @return {@code true} if this is a vanilla beanlet.
099         */
100        boolean isVanilla();
101        
102        /**
103         * Returns {@code true} if this component is created from a static context.
104         */
105        boolean isStatic();
106        
107        /**
108         * Returns {@code true} if the specified meta data type is available for
109         * this beanlet.
110         *
111         * @return {@code true} if meta data is available for specified type.
112         */
113        boolean isMetaDataPresent(Class<? extends MetaData> metaDataType);
114        
115        /**
116         * Returns a list of meta data objects of the specified type.
117         *
118         * @return list of specified meta data objects for beanlet.
119         */
120        <M extends MetaData> List<M> getMetaData(Class<M> metaDataType);
121        
122        /**
123         * Returns a list of meta data objects for this beanlet.
124         *
125         * @return list of meta data objects for beanlet.
126         */
127        List<MetaData> getMetaData();
128    }