aspose file tools*
The moose likes Java in General and the fly likes generic code to display properties of any pojo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "generic code to display properties of any pojo" Watch "generic code to display properties of any pojo" New topic
Author

generic code to display properties of any pojo

saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
hello every one,
i am facing a problem where in which i used to get a List object which contains Object[] and i used iterate for a single Object and display it's content. Upto now it's working fine.

But now i am forced to use the particular type of POJO that is being populated into the List object, at any point of time the List will hold only the array of any particular type.

Now how to display the content of every object in the List.

Please help in this regard.
Soumyajit Hazra
Ranch Hand

Joined: Jun 26, 2007
Posts: 136
Could you explain it with some code or more details.


Java Programmer | SCJP 1.5 | SCWCD 1.4
saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
If i explain with the code then i guess this form will be moved to hibernate, but i fell that the problem i am facing can be done with java.
OK well i will explain it.
There is a new type in oracle DB which called SD0_GEOMETRY, this particular type is not hibernate core which supported in hibernate-spatial with proper dialects.
The problem with my scenario is i will not know which particular table will be selected by the user (in UI) as i mentioned earlier we have the Objects in the List object which we iterate in the jsp.

Now with the introduction of the new type SD0_GEOMETRY, the hibernate is unable to map the particular type into a generalized one untill being specfied for a particular type, by doing so we get the same type of objects into List.




now how to display the content of the List?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ideally the objects in the list would expose a method to display properties, and each object would be able to customize its display method as necessary.
saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
can you make it more clear with an example
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Not really; just have the objects implement an interface that has a single method for displaying the properties. Call that method.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: generic code to display properties of any pojo