Have ran into a case similar to the following. Let's use a simple example for discussion purposes. Say you want to make a "Pepperoni Pizza" and you use the decorator pattern. So you end up with some statement like:
Pepperoni, Onions, Mozzarella, TomatoSauce, PlainPizza all extend a "PizzaDecorator" abstract class so this works to combine their shared properties like cost, toppings into one object.
But the issue I am having is when I want a single property or properties which applies only to this specific combination, like a name property (Name="Pepperoni Pizza.")
It would be possible to develop more complicated schemes for combining each decorator's name with those of the client. e.g. Maybe if my name precedence is equal to my client's, then I'll prepend my ingredient with an "and":
new Sausage(new Pepperoni(new Onion(new Ham(new Mozzarella(new TomatoSauce(new PlainPizza())))))).Name(); could return "Sausage and Pepperoni and Ham Pizza"
You could either work this into the PizzaDecorator class or create a separate Strategy object that looks at the whole hierarchy of PizzaDecorators and determines the correct name. e.g. If (the list of decorators contains at least one Ham and at least one Pineapple and no other meats) then name = "Hawaiian Pizza".
If the name is a property of the Combination, not the ingredients that decorate the pizza, then I wouldn't make name as a property of the pizza. Decorator pattern applies to behavior that can be decorated (for example cost). If a behavior cannot be decorated (for example name), you shouldn't be using a decorator pattern. Trying to put non-decorator like behavior on a decorator pattern is like putting a square peg in a round hole.
Actually, the pizza example is used to illustrate decorator pattern, but in real life, I wouldn't use a decorator pattern for pizzas, because real life pizza behavior doesn't follow decorator pattern. What if you want to model pizzas that have half the ingredients on one side, and other half on another side? What if you get a discount for using certain number of ingredients? No sirree bob.. I stick with composite pattern thankyouveddymuch
IMO, the perfect example of decorator pattern is InputStream interface. Beautifully thought out and implemented.