org.apache.commons.betwixt.registry
Class DefaultXMLBeanInfoRegistry

java.lang.Object
  extended by org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry
All Implemented Interfaces:
PolymorphicReferenceResolver, XMLBeanInfoRegistry

public class DefaultXMLBeanInfoRegistry
extends java.lang.Object
implements XMLBeanInfoRegistry, PolymorphicReferenceResolver

The default caching implementation. A hashmap is used.

Version:
$Id: DefaultXMLBeanInfoRegistry.java 438373 2006-08-30 05:17:21Z bayard $
Author:
Robert Burrell Donkin

Constructor Summary
DefaultXMLBeanInfoRegistry()
           
 
Method Summary
 void flush()
          Flush existing cached XMLBeanInfo's.
 XMLBeanInfo get(java.lang.Class forThisClass)
          Get XMLBeanInfo from cache.
 void put(java.lang.Class forThisClass, XMLBeanInfo beanInfo)
          Put into cache
 java.lang.Class resolveType(ElementMapping mapping, ReadContext context)
          Checks all registered XMLBeanInfo's for the first suitable match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultXMLBeanInfoRegistry

public DefaultXMLBeanInfoRegistry()
Method Detail

get

public XMLBeanInfo get(java.lang.Class forThisClass)
Get XMLBeanInfo from cache.

Specified by:
get in interface XMLBeanInfoRegistry
Parameters:
forThisClass - the class for which to find a XMLBeanInfo
Returns:
cached XMLBeanInfo associated with given class or null if no XMLBeanInfo has been associated

put

public void put(java.lang.Class forThisClass,
                XMLBeanInfo beanInfo)
Put into cache

Specified by:
put in interface XMLBeanInfoRegistry
Parameters:
forThisClass - the class to cache the XMLBeanInfo for
beanInfo - the XMLBeanInfo to cache

flush

public void flush()
Flush existing cached XMLBeanInfo's.

Specified by:
flush in interface XMLBeanInfoRegistry

resolveType

public java.lang.Class resolveType(ElementMapping mapping,
                                   ReadContext context)
Checks all registered XMLBeanInfo's for the first suitable match. If a suitable one is found, then the class of that info is used.

Specified by:
resolveType in interface PolymorphicReferenceResolver
Parameters:
mapping - ElementMapping describing the (polymorphic) element being mapped, not null
context - ReadContext, not null
Returns:
the Class describing the type to which this element should be bound, or null if the reference cannot be resolved
Since:
0.7
See Also:
PolymorphicReferenceResolver.resolveType(org.apache.commons.betwixt.io.read.ElementMapping, org.apache.commons.betwixt.io.read.ReadContext)


Copyright 2002-2008 The Apache Software Foundation. All Rights Reserved.