简体   繁体   中英

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 .

I've tried to use the query:

self select: [ :each | each declaredType: String ]

But this stops with an

error: "MessageNotUnderstood"

declaredType: is a setter, so you are trying to change the declaredType, which is expected to be a FAMIXType . Thus the MessageNotUnderstood.

A possible approach is to get the declaredType (which is a (sub)instance of FAMIXType ) and ask for the smalltalkClass . Note that declaredType may not exist.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM