commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dschava" <dsch...@gmx.de>
Subject [betwixt] Caching instances of XMLIntrospector
Date Thu, 12 Oct 2006 15:13:17 GMT
Hello,

I've tried to cache the introspection results by reusing instances of
XMLIntrospector. But it turned out that simply calling
setXMLIntrospector on an instance of BeanReader won't do the job
completely. I think the reason is that addBeanCreateRule is not called
when setting the Introspector.

The problem can be fixed by changing BeanReader#setXMLIntrospector to
something similar to the following:

	public void setXMLIntrospector(XMLIntrospector introspector) {
		this.introspector = introspector;

		if (introspector != null) {
			final Iterator it =
introspector.getRegistry().beanInfoIterator();

			while (it.hasNext()) {
				XMLBeanInfo xmlInfo = (XMLBeanInfo)
it.next();
	
registeredClasses.add(xmlInfo.getBeanClass());

				ElementDescriptor elementDescriptor =
xmlInfo
						.getElementDescriptor();

				String path =
elementDescriptor.getQualifiedName();

				addBeanCreateRule(path,
elementDescriptor, xmlInfo.getBeanClass());
			}
		}
	}


Or am I missing something? Worth putting this into JIRA ?


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message