aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to define the member variables in value Object with dynamic schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to define the member variables in value Object with dynamic schema" Watch "How to define the member variables in value Object with dynamic schema" New topic
Author

How to define the member variables in value Object with dynamic schema

Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
Hii guys .. I am reading the schema and loading the data based on the schema
defined in my file so if schema changes (field names, number of fields or its length) it won't affect my code. I want to implement the value object pattern but for that i should know each fields to crate my value object class so i can provide the getter and setters for the fields but that violates the dynamic schema generation as i have to provide manually each fields like


.Any views on this ?? or simply i should ignore this pattern and stick with
my interface methods which has String [] in signature instead of the Value Object...Any suggestions..??


SCJP 1.4<br />SCWCD 1.4(91%)<br />Working on SCJD -Bodgitt & Scrapper Constructions...<br /> <br />"It takes 43 muscles to frown & 17 to smile but it doen't take any to just sit there with a dumb look on your face .. Keep Smiling "
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi,
This thema is already in discusion on :
http://www.coderanch.com/t/188603/java-developer-SCJD/certification/Searching-at-business-service-layer

You can join us if you want to.

Regards M.


SCJP, SCJD, SCWCD, OCPJBCD
Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
hiii Mihai .. I guess you don't get my question ..I have fieldName and fieldLength in the hash table.which supports dynamic schema which means i dont need to care about how many fields are there..whats there size..but challenge is if you know the fields at runtime then how do you design a value object class which has fields and its getter/setter ...note that i dont know anything about fields..it will be resolved at runtime from hashtable.. In this scenario how do you design your Value Object class where the fields should be known and you provide getter /setter for that...
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Bhavik,

Well, my Value Object is also dynamic.

...the fields should be known...

This is true, the Value Object knows about the records fields, you can provide this informaion harcoded(a string array) or dynamic using a data scheme(the actaul one).

Regards M.
[ September 27, 2006: Message edited by: Mihai Radulescu ]
subu ananthram
Ranch Hand

Joined: May 16, 2004
Posts: 102
Howdy folks

After a huge hiatus I have again started looking at my SCJD assignment.
Now regarding the dynamic database schema and using a value object
I have the same question.Initially I thought of doing that having a field object with a name and value and a record object that has many field objects in it...Now the thing is this really is messy and I don't know how I can implement this end to end i.e in the front end as well.Its unlikely that I can add a couple of fields in my header and expect those fields to miraculously appear in my front end......Any inputs I am thinking of moving towards the plain old ValObj hard coded........
Another qn I had was the database schema is given to us so the only reason we parse the metadata is because we want to know the order of the fields in our dat file is it.......

Regards
Priya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to define the member variables in value Object with dynamic schema