Guice 可以配置为隐藏堆栈跟踪中的类路径吗?
Guice 的堆栈跟踪可能会变得非常冗长,以至于读起来非常痛苦。这是一个例子:
1) No implementation for java.util.Set<com.mydomain.myapp.android.activities.catbrowser.generalizedbrowser.listview.helpers.databaseitem.itemmanipulators.ItemManipulator<com.mydomain.myapp.flash.Cat>> annotated with @com.google.inject.assistedinject.Assisted(value=) was bound.
while locating java.util.Set<com.mydomain.myapp.android.activities.catbrowser.generalizedbrowser.listview.helpers.databaseitem.itemmanipulators.ItemManipulator<com.mydomain.myapp.flash.Cat>> annotated with @com.google.inject.assistedinject.Assisted(value=)
...
如果我可以隐藏类路径,它看起来会像:
1) No implementation for Set<ItemManipulator<Cat>> annotated with @Assisted(value=) was bound.
while locating Set<ItemManipulator<Cat>> annotated with @Assisted(value=)
有没有办法配置 Guice 来做到这一点?
Guice's stack traces can get so verbose that they are very painful to read. Here's an example:
1) No implementation for java.util.Set<com.mydomain.myapp.android.activities.catbrowser.generalizedbrowser.listview.helpers.databaseitem.itemmanipulators.ItemManipulator<com.mydomain.myapp.flash.Cat>> annotated with @com.google.inject.assistedinject.Assisted(value=) was bound.
while locating java.util.Set<com.mydomain.myapp.android.activities.catbrowser.generalizedbrowser.listview.helpers.databaseitem.itemmanipulators.ItemManipulator<com.mydomain.myapp.flash.Cat>> annotated with @com.google.inject.assistedinject.Assisted(value=)
...
If I could hide the classpath, it would look like:
1) No implementation for Set<ItemManipulator<Cat>> annotated with @Assisted(value=) was bound.
while locating Set<ItemManipulator<Cat>> annotated with @Assisted(value=)
Is there any way to configure Guice to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以答案是否定的。
如果您查看 guice 源代码,您会发现
com.google.inject.internal.Errors
类负责构建错误消息。在此类中,Key
的编码方式如下:下一步是查看
TypeLiteral#toString
方法:其中
MoreTypes#typeToString< /code> 是静态方法,无法配置
So the answer is no.
If you take look at guice source code you will find
com.google.inject.internal.Errors
class that is responsible for building error messages. In this class it is coded that theKey
is converting the following way:Next step is to take a look at
TypeLiteral#toString
method:Where
MoreTypes#typeToString
is a static method that cannot be configured