View Javadoc

1   package org.apache.commons.betwixt.registry;
2   
3   /*
4    * Copyright 2001-2004 The Apache Software Foundation.
5    * 
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * 
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */ 
18  
19  import org.apache.commons.betwixt.XMLBeanInfo;
20  
21  /*** <p>Plug in registry for <code>XMLBeanInfo</code>'s.</p>
22    * 
23    * <p>This decouples the implementation of the <code>XMLBeanInfo</code> cache.
24    * Users can plug in the standard implementations found 
25    * in this package to switch caching on and off.
26    * Alternatively, they can plug-in an exotic cache of their own devising.</p>
27    *
28    * <p>Users can also prime a cache with <code>XMLBeanInfo</code>
29    * classes created programmatically.</p>
30    *
31    * <p>To find a <code>XMLBeanInfo</code> for a class,
32    * <code>XMLIntrospector</code> checks in the registry first 
33    * before starting introspection.
34    * If the registry returns an <code>XMLBeanInfo</code>, then that's used.
35    * Otherwise, the <code>XMLBeanInfo</code> will be found by standard introspection
36    * and then {@link #put} will be called so that the registry 
37    * can cache - if it wished - the <code>XMLBeanInfo</code>. 
38    * </p>
39    *
40    * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
41    * @version $Id: XMLBeanInfoRegistry.java 155402 2005-02-26 12:52:00Z dirkv $
42    */
43  public interface XMLBeanInfoRegistry {
44      
45      /*** 
46        * Get the <code>XMLBeanInfo</code> for the given class.
47        *
48        * @param forThisClass get <code>XMLBeanInfo</code> for this class
49        *
50        * @return <code>null</code> if fresh introspection should be used 
51        * to find the <code>XMLBeanInfo</code>
52        */
53      public XMLBeanInfo get(Class forThisClass);
54      
55      /***
56        * Associate a class with it's <code>XMLBeanInfo</code>.
57        *
58        * @param forThisClass the class to associate with the given bean info
59        * @param beanInfo the <code>XMLBeanInfo</code> to use for the given class
60        */
61      public void put(Class forThisClass, XMLBeanInfo beanInfo);
62      
63      /***
64       * Flush or resets the current registry to it's original state.
65       * It has to be implemented, however could be an empty implementation
66       */
67      public void flush();
68  }