like the name of this topic, i'm looking for the best way to transport a container with 2 different type of data.. let's say 2 Beans or DTO's between layers in an application
i'm thinking in 2 options:
1) create a generic 'ArrayList' (with the type undefined) and put the first DTO in the 0 location and the second DTO in the 1 location
2) create a 'Map' (also with the type undefined) and put both DTO's there
maybe there's a better way to do this. hope someone could help me
The best way is to define a method in the target layer of your application that takes two parameters of the type you want to transport to it. Can you show why that's impractical in your case? A more specific definition of what you mean by transport would help as well.
Agreed--why lose type safety when you don't have to?
Cesar Coz
Ranch Hand
Joined: Aug 19, 2010
Posts: 31
posted
0
well i have 2 different types of data containers (java Beans) and i need them both in an action... and i wanted to call both of them at the same time
anyone knows how to make a 'multiple return' method or maybe just storing both Beans in another object and transport that object will solve it?
Look at the refactoring "Introduce Parameter Object". From Refactoring, Improving the design of existing code by Martin Fowler.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.