Closed tmtrademarked closed 7 years ago
As far as I know, there is no way but to cast every Resource
you get from a HasMany<Resource>
instance in Java.
But you can workaround that in specific cases. For example, have Choice
class extends Resource
and Wine
and Recipe
extends Choice
. Then, perform some OOP magic in Choice
.
Let's imagine that I had a relationship which could contain multiple types of data. For instance, consider the following example:
If all of these were Recipes, I could represent this in Java with HasMany choices. But since they're mixed, is the only way to handle this HasMany and cast check? Or is there a more graceful way to support this use case?