Refactoring Primitive Obsession #689
Unanswered
gregorriegler
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hey Greg! I'm dealing with a similar issue right now. Did you figure out a composite recipe that would work for you? Still trying to figure out a recipe to detect methods of a given primitive. I also was considering using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to get started writing Recipes and struggling.
What I would like to do is detect a primitive collection such as
List<Product>
and turn it into a
ProductList
that encapsulates the list via composition.For that I see the following steps necessary:
List<Product>
that were actually used such asadd
, andremove
.ProductList
that holdsList<Product>
as a field and delegates methods that were previously used.List<Product>
toProductList
For 3. I could use the preexisting
ChangeType
recipe, however, then I needed to make a composite of many Recipes. This is already my first Question. Can I make a composite of many Recipes and test it as well as use it as if it was just a single one?update: just noticed that recipes implement a chain of responsibility.
How would you go about solving this problem overall?
How could I find all used methods of List to use them in a new JavaTemplate that created the WrapperClass? Ideas welcome.
greetings,
Gregor
Beta Was this translation helpful? Give feedback.
All reactions