如何确定方法返回某个值的原因

发布于 2025-01-12 17:20:32 字数 252 浏览 2 评论 0原文

我如何确定为什么我从方法中专门获得这个值? (无需调试器,更改代码或复制它们)

好的,现在我解释我的问题的含义。我有一个包含许多关系和设置的大项目,我想知道预期结果何时被过滤或更改并变得不合适。主要目的是知道哪个过滤器或方法过滤了预期结果。

当然,我检查了 AnnotationsReflection API,但就我而言,它不合适,因为有太多案例和参数。

谢谢您的任何建议!

How I can to determine why I get specifically this value from method? (without debugger, changing code or duplicate them)

Ok, now I explain the meaning of my question. I have big project with many relations and settings and I want to know when expecting result filtered or changed and became not suitable. The main aim is know which of the filters or method filtered expected result.

Of course I checked Annotations and Reflection API but in my case it isn't suitable because have too much cases and arguments.

Thank you for any advice!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木緿 2025-01-19 17:20:32

因此,听起来您需要返回一个描述过滤器或方法所做决策的对象。可以以某种方式总结决策的东西。例如:

values = [ 'foo', 'bar', 'bang' ]
constraint = { it == 'foo' }

Result r = filter.apply( values, constraint )
r.value() == [ 'foo' ]
r.input == [ values, constraint ]

类似的事情。如果没有提供太多细节,就很难比这更清楚了,但 Result 将是一个对象,它不仅捕获输出(即 value()),还捕获调用它的条件。您可以通过组合“结果”->“使其变得更复杂”例如,复合滤波器的 Results1 ... ResultsN。但我真的不明白你在做什么详细说明。但其想法是,您可以设想一个结果对象图,该图跟踪作为数据集过滤器应用的复杂逻辑,并询问哪些内容丢失了。

So it sounds like you need to return an object that describes the decisions made by a filter or method. Something that can summarize decisions in some way. For example:

values = [ 'foo', 'bar', 'bang' ]
constraint = { it == 'foo' }

Result r = filter.apply( values, constraint )
r.value() == [ 'foo' ]
r.input == [ values, constraint ]

Something along those lines. Without much detail provided it's hard to be more clear than that, but Result would be an object that captures not just the output (ie value()), but also the conditions in which it was called. You can make it more complex by combining Results -> Results1 ... ResultsN for composite filters for example. But I don't really understand what you are doing at any level of detail to elaborate. But the idea is that you could envision a graph of results objects that trace the complex logic applied as a filter on a dataset, and interrogate where things dropped out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文