Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data dictionary for displaying value objects

 
Carl Bradbury
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm currrently working on a project in which we are pulling a set of value objects back from a data server and displaying the attributes of these objects in a JSP. The framework I am using is Struts 1.1.
The value object's attributes are mostly custom typesafe enums (see Effective Java, Bloch, p105) that Struts doesn't have a clue how to handle, as you'd expect.
Currently I am 'wrapping' the returned objects into a composite object that contains the returned value objects and provides me with accessor methods that convert the enums into Strings for displaying.
Although this is a quick and easy fix, does anyone have any suggestions on a more flexible approach? i.e. something that doesn't require me to write one wrapper class for each set of value objects returned. I've heard mention that a data dictionary might be useful, in which I map the contents of each value object within an XML file that defines the type of each field. I could then use a generic class to handle each object according to the definitions in the dictionary.
Can anyone point me to an example of this kind of solution?
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Nondescript",
Welcome to JavaRanch. We don't have many rules here, but one we do have is a naming policy. Please edit your display name to comply with this policy. Thanks in advance, and we look forward to seeing you around the Ranch.
[I see on the topic list on the main Saloon page that your name at one time showed up as "Carl Bradbury" and not "Nondescript".]
[ December 16, 2003: Message edited by: Jason Menard ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic