[英]Find methods with return type String
I try to create a query to get all methods with a specific return type. 我尝试创建一个查询以获取具有特定返回类型的所有方法。 Looking at the definitions of
FAMIXMethod
and FAMIXBehavioralEntity
I think the declaredType: is the correct method for this query on FAMIXMethodGroup
. 查看
FAMIXMethod
和FAMIXBehavioralEntity
的定义,我认为声明的FAMIXBehavioralEntity
:是此FAMIXMethodGroup
查询的正确方法。
I've tried to use the query: 我尝试使用查询:
self select: [ :each | each declaredType: String ]
But this stops with an 但这以
error: "MessageNotUnderstood"
错误:“ MessageNotUnderstood”
declaredType:
is a setter, so you are trying to change the declaredType, which is expected to be a FAMIXType
. FAMIXType
declaredType:
是一个setter,所以您尝试更改FAMIXType
,它应该是FAMIXType
。 Thus the MessageNotUnderstood. 因此,MessageNotUndertood。
A possible approach is to get the declaredType (which is a (sub)instance of FAMIXType
) and ask for the smalltalkClass
. 一种可能的方法是获取声明的
FAMIXType
(这是FAMIXType
的(子)实例)并询问smalltalkClass
。 Note that declaredType may not exist. 请注意,clarifiedType可能不存在。
self select: [ :each |
each hasDeclaredType and: [
each declaredType smalltalkClass isKindOf: String class ] ].
Maybe a simpler approach can be devised with Moose Query, but I am not familiar with that. 也许可以使用Moose Query设计更简单的方法,但是我对此并不熟悉。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.