-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
All enhanced classes should implement a marker interface #187
Comments
From max.ross on March 18, 2008 10:14:02 Sorry, this should have been submitted as an enhancement. I don't see a way to |
From limpbizkit on May 14, 2008 08:23:44 My only anxiety about this is it adds another interface to our API. That interface doesn't do anything and it As a hack workaround, I believe you can differentiate between enhanced and standard classes by calling: Anybody else have an opinion on this? Labels: -Type-Defect Type-Enhancement |
From limpbizkit on May 14, 2008 09:26:17 (No comment was entered for this change.) Labels: -Priority-Medium Priority-Low |
From max.ross on May 14, 2008 09:45:45 Your suggestions is exactly what I'm doing, but it's relying on an internal My mistake for trying to dictate the solution rather than just explaining the problem One use case is when you have a Map keyed by Class. Maybe you're mapping the Class Processor getProcessor(Foo foo) { If you're using Guice and a module is setting up interceptors on instances of Foo and I'd be happy with any mechanism that allows me to reliably determine if I'm dealing Thanks, |
From dhanji on January 30, 2009 21:48:06 This kind of requirement is quite common in classpath scanning code (though I think, not the greatest idea in |
From rcouto on January 31, 2009 04:46:40 Are these objects instances of classes you control (meaning, are they instantiated by |
From cgruber@google.com on July 16, 2012 11:05:08 Marking acknowledged pending prioritization. Status: Acknowledged |
From bruno.medeiros@visagio.com on November 22, 2012 05:03:16 I also miss this feature a lot, and I don't see any problem in inserting a new interface. I'm using Guice now to replace a library internally developed and we have such a mark interface, called EnhancedClass. We do the following: Enhancer enhancer = new Enhancer(); > That interface doesn't do anything and it encourages users to use instanceof. I don't see any reason to avoid the instanceof operator, could you explain more on this? |
From bruno.medeiros@visagio.com on November 22, 2012 07:24:53 One more comment, the workaround should be boolean isEnhanced = getClass().getName().contains("EnhancerByGuice") instead of boolean isEnhanced = getClass().getName().contains("EnhancedByGuice"); At least on Guice 3.0 it is. |
From cgruber@google.com on November 18, 2013 11:59:40 (No comment was entered for this change.) Status: Accepted |
From cgruber@google.com on November 18, 2013 12:00:54 (No comment was entered for this change.) Labels: Milestone-Release4.0 |
Any progress on this? I'm happy to send a PR but I'm not sure where to put the new API. I figure it should be something like |
I'd also like to see this fixed, my code is still as dirty as |
+1 on this issue. We are using:
to get real class names |
From max.ross on March 18, 2008 00:19:58
All enhanced classes should implement a marker interface so that client
code has a reliable way to determine if an object is an instance of a
Guice-enhanced class. Ideally the interface(s) would be configurable by
the client, but if Guice just has its own interface that its proxies always
implement that would be cool too.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=187
The text was updated successfully, but these errors were encountered: