Object to Object Mapping

There are a need of mapping an object from the client to another object on the server. Is there a design pattern for this problem?
[137 byte] By [airwolfa] at [2007-9-28 5:16:43]
# 1
proxy?Just a guess.
turri69_fia at 2007-7-9 16:27:45 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
The java Object class from the client is different from the java object class from the server. If i need to map the client java and transform to a object in the server, how should we design this?
airwolfa at 2007-7-9 16:27:45 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

This really depends on what exactly you mean by 'mapping'

It might be that a simple java.util.Map does the job, although

some kind of proxy/deligate/facade sounds more like it.

Can you give an example of what kind of objects we are talking and what's the purpose of the mapping?

spielera at 2007-7-9 16:27:45 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
For example the Server Class is know as CustomerAnd on the client it is using ClientCustomerboth the fieldname is having different name and the there is a need to map both of them.Regards
airwolfa at 2007-7-9 16:27:45 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

I wouldn't know of a pattern to do such a thing ... except you consider refactoring a pattern.

But in the jakarta/apache common project is class or package to access bean properties by their names. Maybe you could use those, together with a properties file for configuration to do your mapping.

Of course ... while this might safe some coding time it will use reflection and there for is relativly slow.

regards

Spieler

spielera at 2007-7-9 16:27:45 > top of Java-index,Other Topics,Patterns & OO Design...