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