JavaRef subclass:#JavaMethodref
instanceVariableNames:'method sel'
classVariableNames:''
poolDictionaries:''
category:'Java-Reader-Support'
!
!JavaMethodref methodsFor:'accessing'!
name
^ nameandType name.
!
selector
sel isNil ifTrue:[
sel := (nameandType name , nameandType signature) asSymbol.
].
^ sel
!
signature
^ nameandType signature.
! !
!JavaMethodref methodsFor:'printing & storing'!
displayString
^ 'JavaMethodRef (' , class displayString , ' '
, '''' , nameandType name , '''' , nameandType signature , ')'
! !
!JavaMethodref methodsFor:'resolving'!
method
|nm sig mthd|
method notNil ifTrue:[^ method].
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
class := class resolve
].
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
self halt.
].
sel isNil ifTrue:[
nm := nameandType name asSymbol.
sig := nameandType signature.
sel := (nm , sig) asSymbol.
].
"/ 'search in: ' print. class fullName print. ' for ' print. nm print. ' sig: ' print. sig printNL.
class selectorArray keysAndValuesDo:[:idx :mSel |
"/ idx print. ' 'print. sel printNL.
sel == mSel ifTrue:[
^ class methodArray at:idx.
"/ mthd := class methodArray at:idx.
"/ 'try: ' print. mthd signatureName printNL.
"/ mthd signature = sig ifTrue:[
"/ method := mthd.
"/ ^ mthd
"/ ]
]
].
self halt.
!
methodFor:aClass
|nm sig mthd cls|
cls := aClass.
(cls isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
class := class resolve
].
(cls isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
self halt.
].
sel isNil ifTrue:[
nm := nameandType name asSymbol.
sig := nameandType signature.
sel := (nm , sig) asSymbol.
].
[cls notNil] whileTrue:[
cls selectorArray keysAndValuesDo:[:idx :mSel |
"/ idx print. ' 'print. sel printNL.
sel == mSel ifTrue:[
^ cls methodArray at:idx.
"/ mthd := cls methodArray at:idx.
"/ mthd signature = sig ifTrue:[
"/ method := mthd.
"/ ^ mthd
"/ ]
]
].
cls := cls superclass
].
^ nil
! !
!JavaMethodref class methodsFor:'documentation'!
version
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethodref.st,v 1.7 1996/05/03 11:28:51 cg Exp $'
! !