Does such design pattern exists? It is similar but opposite to a factory pattern. The factory accepts a single input (e.g. type A) and creates a variant output (e.g. type X or Y 开发者_如何学运维or Z), depending on the input.
The pattern I'm thinking accepts various different types of input (e.g. type X or Y or Z) but produces only a single type of output (e.g. type A). What pattern is this, if it exists?
That's not a pattern per se, but rather it would require implementing the Adapter pattern as appropriate.
If you are looking for constructing an object from different inputs (objects), the closest I think is Builder pattern. But the intention of builder is to separate construction logic, check http://en.wikipedia.org/wiki/Builder_pattern , if this is what you are looking for .
精彩评论