JavaNativeMethod.st
author cg
Thu, 23 Dec 1999 17:46:10 +0000
changeset 642 3f9842e199be
parent 616 53bf2ec50346
child 654 da8d060a3150
permissions -rw-r--r--
checkin from browser

JavaMethodWithHandler variableSubclass:#JavaNativeMethod
	instanceVariableNames:'nativeImplementation'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Classes'
!


!JavaNativeMethod class methodsFor:'initialization'!

initialize
    self flags:(self flags bitOr:Behavior flagJavaMethod).
! !

!JavaNativeMethod methodsFor:'accessing'!

nativeImplementation
    "return the value of the instance variable 'nativeImplementation' (automatically generated)"

    ^ nativeImplementation

    "Created: / 25.9.1999 / 23:08:00 / cg"
!

nativeImplementation:something
    "set the value of the instance variable 'nativeImplementation' (automatically generated)"

    nativeImplementation := something.

    "Created: / 25.9.1999 / 23:08:00 / cg"
! !

!JavaNativeMethod methodsFor:'vm support'!

nativeMethodInvokation
    |nm sel mthd|

    (mthd := nativeImplementation) isNil ifTrue:[
        nm := selector copyWithoutLast:signature size.
        sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.

        mthd := (JavaVM class compiledMethodAt:sel).
        (mthd isNil or:[mthd isLazyMethod]) ifTrue:[
            ^ JavaVM 
                perform:sel
                with:thisContext sender.
        ].
        nativeImplementation := mthd.
    ].

    ^ mthd
        valueWithReceiver:JavaVM
        arguments:(Array with:thisContext sender)
        selector:selector
        search:JavaVM class
        sender:nil

    "Modified: / 25.9.1999 / 23:10:29 / cg"
! !

!JavaNativeMethod class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaNativeMethod.st,v 1.3 1999/12/23 17:46:10 cg Exp $'
! !
JavaNativeMethod initialize!