001 package org.apache.commons.betwixt.registry;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one or more
005 * contributor license agreements. See the NOTICE file distributed with
006 * this work for additional information regarding copyright ownership.
007 * The ASF licenses this file to You under the Apache License, Version 2.0
008 * (the "License"); you may not use this file except in compliance with
009 * the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 import org.apache.commons.betwixt.XMLBeanInfo;
021
022 /** <p>Plug in registry for <code>XMLBeanInfo</code>'s.</p>
023 *
024 * <p>This decouples the implementation of the <code>XMLBeanInfo</code> cache.
025 * Users can plug in the standard implementations found
026 * in this package to switch caching on and off.
027 * Alternatively, they can plug-in an exotic cache of their own devising.</p>
028 *
029 * <p>Users can also prime a cache with <code>XMLBeanInfo</code>
030 * classes created programmatically.</p>
031 *
032 * <p>To find a <code>XMLBeanInfo</code> for a class,
033 * <code>XMLIntrospector</code> checks in the registry first
034 * before starting introspection.
035 * If the registry returns an <code>XMLBeanInfo</code>, then that's used.
036 * Otherwise, the <code>XMLBeanInfo</code> will be found by standard introspection
037 * and then {@link #put} will be called so that the registry
038 * can cache - if it wished - the <code>XMLBeanInfo</code>.
039 * </p>
040 *
041 * @author <a href="mailto:rdonkin@apache.org">Robert Burrell Donkin</a>
042 * @version $Id: XMLBeanInfoRegistry.java 438373 2006-08-30 05:17:21Z bayard $
043 */
044 public interface XMLBeanInfoRegistry {
045
046 /**
047 * Get the <code>XMLBeanInfo</code> for the given class.
048 *
049 * @param forThisClass get <code>XMLBeanInfo</code> for this class
050 *
051 * @return <code>null</code> if fresh introspection should be used
052 * to find the <code>XMLBeanInfo</code>
053 */
054 public XMLBeanInfo get(Class forThisClass);
055
056 /**
057 * Associate a class with it's <code>XMLBeanInfo</code>.
058 *
059 * @param forThisClass the class to associate with the given bean info
060 * @param beanInfo the <code>XMLBeanInfo</code> to use for the given class
061 */
062 public void put(Class forThisClass, XMLBeanInfo beanInfo);
063
064 /**
065 * Flush or resets the current registry to it's original state.
066 * It has to be implemented, however could be an empty implementation
067 */
068 public void flush();
069 }