Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] final Attribute.getValue()

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Romain Deltour <romain.deltour AT inrialpes.fr>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] final Attribute.getValue()
  • Date: Tue, 21 Feb 2006 16:15:23 +0100

I think it would be really useful to allow subclasses override the Attribute.getValue() method, here is a use case:

say you want to write a subclass of Attribute to represent integer attributes (call it IntAttribute).
In order to avoid tons of string parsing, you want to store the core info in an int, and parse it back to a string only when you need to call the getValue() method (then sync'ing the int with the string value).

Cases where the specific string parsing are a lot more time-consuming exists, just take list values, where you will want to directly deal with lists in your subclasses rather than with strings.

My suggestion is to make getValue() overridable (and maybe to replace reading access to the 'private String value' field in the core class by calls to the getter, if we can afford a method call).

What do you think ?

Romain.




Archive powered by MHonArc 2.6.24.

Top of Page