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