commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allen,Eva" <>
Subject [Digester] Can use inner classes?
Date Wed, 18 Oct 2006 02:04:28 GMT
I'm attempting to write a small parser as part of another larger
application.  I'd like to do something like the following:

public class Parser {

	ClassA s = new ClassA();
	Digester d;
class ClassA {
   LinkedList ClassB;
   public void addClassB();
class ClassB {
  String data1;
  String data2;
  String data3;
  public getters and setters;

I'm using an xmlrules file looks like
   <pattern value="resolver">
	<object-create-rule classname="ClassB" />
	<set-properties-rule />
	<set-next-rule methodname="addClassB" />

	<pattern value="data1">
		<call-method-rule methodName="setData1" paramCount="0"

This all works fine as long as ClassA and ClassB are public classes.
But as soon as I try to make them inner classes of the Parser class this
fails with an IllegalAccessException (Cannot access a member of class
ClassB with modifiers "").

The Digester Developer Guide mentions something about this as a known
limitation and says to ask on the mailing list if I think I'm
experiencing the problem it mentions.  So I'm asking.  Is there a way
around this or am I forced to have public classes for use with the

Since I originally wrote this I've found that I could use the
FactoryCreateRule to create an object that doesn't have a no-argument
constructor, but I haven't been able to find a proper ruleset that will
allow me to do this.  Any suggestions?
Eva Allen
Consulting Software Engineer, OCLC, Inc.
6565 Frantz Rd., Dublin, OH  43017
614.764.6009 |
Views contained herein are my own; they do not necessarily reflect those
of my employer

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message