-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFE: Add a convenience method for the full set of types for a type #50
Comments
No problem! Glad you find it useful -- it seemed like something that was missing, and was sort of fun to extract out of Jackson (or rather... try to extract, realize how much it needed full rewrite... and eventually while Jackson does not use it as is due to compatibility reasons, also provided a few fixes to Jackson itself). Now, convenience method(s) sound(s) reasonable. Ideally I guess it/those would be via I am not sure how much time I have to work on this, but typically I do try to follow-up on PRs. |
Thinking about this a bit, I think it'd be useful to have couple of different new methods:
and possibly helper variants that take For now I'll consider this to be just for (3), but I may want to make bigger addition. As to return type, I think |
Do consider defining (in javadoc) an order to the |
I could specify use of But it almost seems like if caller really wants specific ordering, may be their should implement traversal themselves? |
…although to be fair if they're implementing traversal themselves…then why…are they using this framework 😄 😄 😄 |
I meant traversal of resolved super types, to get the collection in exact order caller wants -- versus just getting a Set/Collection of super types in arbitrary order. I am just not sure how much can or should be guaranteed about order of entries when I am not really sure what ordering(s) would be useful -- when combining interfaces and super classes, for example, which should come first? |
Sure; was just having a little bit of fun. I think what's important is that there is an order, not so much what the order is. The Weld/CDI case I was thinking of had to do with proxy class naming: they build up a proxy class name out of the types and interfaces in the type closure. Obviously if that order changes then you end up creating proxy classes instead of loading existing ones etc. |
Heh. Yeah, just wanted to make sure. I can see benefit of stable ordering, but now that I think of this, I am not sure how stable it can be. Specifically: traversal order can't really be guaranteed for, say, implemented interface as JDK does not expose interfaces in guaranteed order AFAIK. One could of course sort them explicitly by classname. Although... maybe it should? Sort by classname and be done? Then simple Another issue to file, perhaps :) |
Yes, exactly. That's how I ended up doing it, with the same reservations. |
Thanks for a great project!
It would be helpful if there were a method on
ResolvedType
that could provide aList
orSet
of all implemented and extendedType
s.I know that
ResolvedType
hasgetImplementedInterfaces()
. And I know thatTypeResolver
hasgetParentClass()
. It would be nice if there were a method likepublic Set<ResolvedType> getAllTypes()
or something of that nature implemented in terms of the other two.I would expect, for example, that if it were passed
String.class
the returned set would include types representing:Object
Comparable<String>
CharSequence
String
Serializable
The text was updated successfully, but these errors were encountered: