1 /* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2005, JBoss Inc., and individual contributors as indicated 4 * by the @authors tag. See the copyright.txt in the distribution for a 5 * full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 package org.jboss.classadapter.spi; 23 24 import java.util.List; 25 26 import org.jboss.joinpoint.spi.JoinpointFactory; 27 import org.jboss.reflect.spi.ClassInfo; 28 import org.jboss.repository.spi.MetaDataContext; 29 import org.jboss.repository.spi.MetaDataContextFactory; 30 import org.jboss.util.JBossInterface; 31 32 /** 33 * A class adapter.<p> 34 * 35 * A class adapter is the integration point for manipulating 36 * class information at runtime, e.g. overriding annotations 37 * or obtaining an aop instance advisor.<p> 38 * 39 * The class adapter has the following protocol. 40 * 41 * <ol> 42 * <li> Use getClassInfo to obtain information about 43 * the class. 44 * <li> Obtain an Instance ClassAdapter if the class information 45 * should be overridden at the instance level, e.g. annotations 46 * <li> Obtain the dependencies of the Class/Instance and any 47 * advice factories, e.g. @Depends annotations 48 * <li> Obtain the JoinpointFactory so the instance can be 49 * constructed. 50 * </ol> 51 * 52 * FIXME: This class deals with too many concerns 53 * FIXME: Need a mechanism to allow different use cases 54 * for the unadvised case. 55 * i.e. whether in the absence of aop requirements 56 * the adapter should give a proxy advisor, 57 * instrument the class for aop anyway 58 * or default back to reflection (most likely!) 59 * 60 * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a> 61 */ 62 public interface ClassAdapter extends JBossInterface 63 { 64 /** 65 * Get the class info. 66 * 67 * @return the class info 68 */ 69 ClassInfo getClassInfo(); 70 71 /** 72 * Get an instance adapter. 73 * 74 * @param classInfo the changed class info 75 * @return instance adapter 76 */ 77 ClassAdapter getInstanceAdapter(ClassInfo classInfo); 78 79 /** 80 * Get the dependencies of this adapter 81 * 82 * @return the list of dependencies 83 */ 84 List<Object> getDependencies(); 85 86 /** 87 * Get the Joinpoint Factory for this adapter. 88 * 89 * @return the joinpoint factory 90 */ 91 JoinpointFactory getJoinpointFactory(); 92 93 /** 94 * Get the classloader associated with this class adapter 95 * 96 * @return the classloader 97 */ 98 ClassLoader getClassLoader(); 99 100 /** 101 * Get the MetaDataContextFactory for this adpater 102 * 103 * @return the metadata context factory 104 */ 105 MetaDataContextFactory getMetaDataContextFactory(); 106 107 /** 108 * Get the metadata context 109 * 110 * @return the metadata context 111 */ 112 MetaDataContext getMetaDataContext(); 113 114 /** 115 * Set the metadata context 116 * 117 * @param metaCtx a metadata context 118 */ 119 void setMetaDataContext(MetaDataContext metaCtx); 120 } 121