Hi,
I get a request in the format of string. I have to parse this string, get to know what type of request it is and populate different fields in objects of corresponding request class. There are around 6 request classes. These request classses have some fields in common but not all. I want to do parsing the string and getting required fields at only one place and I do not want to repeat this in every request class. how can I achive this? By using which design pattern?
|
Newbie Member
|
|
| 12Oct2009,16:29 | #2 |
|
To further clarify things, I have a class known as RMG2BUF. The request string is parsed and it builds a tree structure, each node being of type RMG2NODE. RMG2BUF class provides a way of traversing this tree and getting the value of any required fields. Now these fields have to be mapped to particular field in objects of 6 different request classes that I told earlier. The different request classes like CreateTTRequest,ModifyTTRequest,CancelTTRequest etc share many common fields. I want to do the fetching of values from RMG2BUF at only one place and I do not want to repeat it in setting common fields of different requests. I want to create something like a utility class which provides functions to set all the fields comprising all the requests but it should set it in the the request class object that I have passed
|
|
Go4Expert Founder
|
![]() |
| 12Oct2009,17:31 | #3 |
|
Your problem is not very detailed and so having just a base class parser could help you.
|
|
Mentor
|
![]() |
| 13Oct2009,13:18 | #4 |
|
Can you give a couple of examples of the kinds of strings you want parsed?
Also you mention "design pattern". What is that, exactly? |


