Hi,
I have a problem with a pattern that has probably been solved a 1000
times before, but I'd appreciate some advice.
I have a scenario where I have a couple of data classes with getters
and setters called HTMLLink and DocumentLink classes, which are
extended from a LinkBase class. I'm wanting to pass these to a service
layer class which has a create method and carries out some business
logic depending on the object type passed in.
I'm in the position where I either have the HTMLLink and DocumentLink
classes with an implementation of the create method, or a big switch
statement in the service object. I'm not too keen on the link classes
having the create because they were supposed to be simple DTO style
objects. On the other hand I don't want a big switch statement in the
service either.
Is there any other way I can cut this? Thanks.