commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Benn <neil.b...@ziath.com>
Subject [digester] Reading in Enums
Date Wed, 04 Jul 2012 19:30:24 GMT
Hello,

  I have a class which holds a set of enums; I'm writing out to the xml
file the name of the enum and I want to read it back in with Digester.
 However I'm having a hard time working out how to do that - has anyone
managed to read in the enums.  I'm currently trying:

Digester digester = new Digester();
digester.addObjectCreate("barcodeScanner", BarcodeScannerModel.class);
digester.addSetProperties("barcodeScanner");
digester.addCallMethod("barcodeScanner/formats/OneDBarcodeFormat",
"addPossibleOneDBarcodeFormat", 1);
digester.addCallParam("barcodeScanner/formats/OneDBarcodeFormat", 0,
"format");

  This however returns the error message of :

java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 4;
columnNumber: 39; Error at line 4 char 39: No such accessible method:
addPossibleOneDBarcodeFormat() on object:
com.ziath.datapaq.application.BarcodeScannerModel
at
com.ziath.datapaq.application.ConfigureBarcodeScannerPanel$ConfigureFileReader.load(ConfigureBarcodeScannerPanel.java:443)

  The method is question is:

public void addPossibleOneDBarcodeFormat(OneDBarcodeFormat format){
this.formats.add(format);
}

  The method is there so I guess it is just the parameter that is the
problem in that Digester is trying to pass a String whereas it needs an
enum.  So, if anyone can help that would be greatly appreciated.

  Thanks.

Cheers,

Neil

-- 

Neil Benn MSc
Ziath Ltd
Phone: +44 (0) 1223 655577
http://www.ziath.com

*Please consider the environment before printing this email.*

Follow us on Facebook <http://www.facebook.com/ziathltd>,
Twitter<http://www.twitter.com/ziath_ltd>or
LinkedIn <http://www.linkedin.com/company/ziath-ltd>

IMPORTANT NOTICE: This message, including any attached documents, is
intended only for the use of the individual or entity to which it is
addressed, and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering the message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify Ziath Ltd immediately by email at info@ziath.com. Thank you.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message