-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings to the JNI and a high level interface generator. -- -- This package offers bindings to the Java Native Interface and a -- high level interface generator. -- -- -- --
--   >>> INSTALLATION / USAGE
--   
-- -- It should suffice to do cabal install (or cabal install -- java-bridge when installing from hackageDB). /You need to have a -- JDK installed prior to installing this library/. -- -- Setup will try to find the location of your java installation -- automatically. This is needed in order to load libjvm. Note -- that this library is loaded dynamically, which means that linking -- errors might not show up during installation. -- -- You can specify the location of libjvm manually using the -- environment variable FFIJNI_LIBJVM. This environment variable -- is consulted by Setup.hs as well as by the library each time -- libjvm is loaded - which means that you can override the path -- to libjvm at any time. The function -- getCompiledLibjvmPath in Foreign.Java.JNI.Safe will -- tell you what path to libjvm has been set during compilation -- of the library. -- --
--   >>> FUN WITH (cabal-) FLAGS
--   
-- -- The following cabal flags are available to you for configuring your -- installation: -- -- -- -- Use for example cabal install -f OSX_FRAMEWORK -f EXAMPLES or -- cabal configure -f DEBUG. @package java-bridge @version 0.9 -- | Utilities for dealing with Class, Package, and Module names in the -- Java and Haskell languages. module Foreign.Java.Utils javaKeywords :: [String] haskellKeywords :: [String] -- | Build the name of a class based on maybe a package and a class name. makeName :: Maybe String -> String -> String -- | Translates a package name into a module name. makePackageModuleName :: String -> String -- | Translates a class name into a module name. makeClassModuleName :: String -> String -- | Splits a class name into package name and class name. -- -- If the name does not contain a package component, the first string is -- empty. -- -- See also joinClassName. splitClassName :: String -> (String, String) -- | Pendant to splitClassName. joinClassName :: (String, String) -> String -- | Retrieve the package name form a simple name of a class. -- --
--   >>> takePackageName "java.lang.A$B"
--   Just "java.lang"
--   
-- --
--   >>> takePackageName "Test"
--   Nothing
--   
takePackageName :: String -> Maybe String -- | Retrieve the class name form a simple name of a class. This also -- contains the name of the enclosing class(es). -- --
--   >>> takeClassName "java.lang.A$B"
--   "A$B"
--   
-- --
--   >>> takeClassName "Thread$State"
--   "Thread$State"
--   
takeClassName :: String -> String -- | Retrieve the class name form a simple name of a class. This contains -- only the name of the class itself. -- --
--   >>> takeBaseClassName "java.lang.A$B"
--   "B"
--   
takeBaseClassName :: String -> String -- | Retrieve the names of the enclosing classes from a simple class name. -- --
--   >>> takeEnclosingClasses "java.lang.Map$EntrySet"
--   ["java.lang.Map"]
--   
-- --
--   >>> takeEnclosingClasses "package.A$B$C"
--   ["package.A", "package.A$B"]
--   
takeEnclosingClasses :: String -> [String] -- | Low level interface to the Java Virtual Machine. This module is a very -- thin wrapper over the Java Native Interface. -- -- Note that all functions that return references (of type Ptr -- JObjectRef) return global references which you will need to free -- manually. -- -- This module contains unsafe bindings, see also -- Foreign.Java.JNI.Safe. -- -- Read the The Java Native Interface - Programmer's Guide and -- Specification for further information on the Java Native Interface -- (available at -- http://www.soi.city.ac.uk/~kloukin/IN2P3/material/jni.pdf, and -- http://192.9.162.55/docs/books/jni/). module Foreign.Java.JNI.Unsafe data JVM createVM :: IO (Ptr JVM) createVM' :: Word32 -> Ptr CString -> IO (Ptr JVM) destroyVM :: Ptr JVM -> IO () persistVM :: Ptr JVM -> IO () data JClassRef findClass :: Ptr JVM -> CString -> IO (Ptr JClassRef) data JConstructorID data JObjectRef getConstructorID :: Ptr JVM -> Ptr JClassRef -> CString -> IO (Ptr JConstructorID) newObject :: Ptr JVM -> Ptr JClassRef -> Ptr JConstructorID -> Ptr JValues -> IO (Ptr JObjectRef) newBooleanArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newCharArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newLongArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newIntArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newShortArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newByteArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newFloatArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newDoubleArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newObjectArray :: Ptr JVM -> Int32 -> Ptr JClass -> Ptr JObjectRef data JStaticMethodID data JMethodID getStaticMethodID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JStaticMethodID) getMethodID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JMethodID) callStaticVoidMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO () callStaticBooleanMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Bool callStaticCharMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Word16 callStaticByteMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int8 callStaticShortMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int16 callStaticIntMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int32 callStaticLongMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int64 callStaticFloatMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CFloat callStaticDoubleMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CDouble callStaticObjectMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO (Ptr JObjectRef) callStaticStringMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CString callVoidMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO () callBooleanMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Bool callCharMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Word16 callByteMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int8 callShortMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int16 callIntMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int32 callLongMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int64 callFloatMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CFloat callDoubleMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CDouble callObjectMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO (Ptr JObjectRef) callStringMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CString data JFieldID data JStaticFieldID getFieldID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JFieldID) getStaticFieldID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JStaticFieldID) getStaticBooleanField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Bool getStaticCharField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Word16 getStaticByteField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int8 getStaticShortField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int16 getStaticIntField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int32 getStaticLongField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int64 getStaticFloatField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CFloat getStaticDoubleField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CDouble getStaticObjectField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO (Ptr JObjectRef) getStaticStringField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CString setStaticBooleanField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Bool -> IO () setStaticCharField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Word16 -> IO () setStaticByteField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int8 -> IO () setStaticShortField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int16 -> IO () setStaticIntField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int32 -> IO () setStaticLongField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int64 -> IO () setStaticFloatField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CFloat -> IO () setStaticDoubleField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CDouble -> IO () setStaticObjectField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Ptr JObjectRef -> IO () setStaticStringField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CString -> IO () getBooleanField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Bool getCharField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Word16 getByteField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int8 getShortField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int16 getIntField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int32 getLongField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int64 getFloatField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CFloat getDoubleField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CDouble getObjectField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO (Ptr JObjectRef) getStringField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CString setBooleanField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Bool -> IO () setCharField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Word16 -> IO () setByteField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int8 -> IO () setShortField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int16 -> IO () setIntField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int32 -> IO () setLongField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int64 -> IO () setFloatField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CFloat -> IO () setDoubleField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CDouble -> IO () setObjectField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Ptr JObjectRef -> IO () setStringField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CString -> IO () data JValues data JArg BooleanA :: Bool -> JArg CharA :: Word16 -> JArg ByteA :: Int8 -> JArg ShortA :: Int16 -> JArg IntA :: Int32 -> JArg LongA :: Int64 -> JArg FloatA :: Float -> JArg DoubleA :: Double -> JArg StringA :: String -> JArg ObjectA :: (Maybe JObject) -> JArg ArrayA :: (Maybe (JArray e)) -> JArg -- | Create a JValues Array which can be used for argument passing to a -- multi parameter method. You need to free the Ptr object manually using -- free. -- -- This method is implemented using calloc internally. See the -- native implementation of newJValues. mkJValues :: Ptr JVM -> [JArg] -> IO (Ptr JValues) newJValues :: CInt -> IO (Ptr JValues) setJValueByte :: Ptr JValues -> CInt -> Int8 -> IO () setJValueShort :: Ptr JValues -> CInt -> Int16 -> IO () setJValueInt :: Ptr JValues -> CInt -> Int32 -> IO () setJValueLong :: Ptr JValues -> CInt -> Int64 -> IO () setJValueFloat :: Ptr JValues -> CInt -> CFloat -> IO () setJValueDouble :: Ptr JValues -> CInt -> CDouble -> IO () setJValueObject :: Ptr JValues -> CInt -> Ptr JObjectRef -> IO () setJValueString :: Ptr JVM -> Ptr JValues -> CInt -> CString -> IO () releaseJObjectRef :: Ptr JVM -> Ptr JObjectRef -> IO () releaseJClassRef :: Ptr JVM -> Ptr JClassRef -> IO () releaseJThrowableRef :: Ptr JVM -> Ptr JThrowableRef -> IO () -- | release is a special function which can be used to create a -- ForeignPtr. A ForeignPtr does not carry a reference to a -- virtual machine (no Ptr JVM), thus this function will lookup -- the current virtual machine or do nothing if it can not find one. It -- is realised as a FunPtr as this is what newForeignPtr -- expects. release :: ReleaseGlobalReference a => FunPtr (Ptr a -> IO ()) data JChars data JBytes newJString :: Ptr JVM -> CString -> IO (Ptr JObjectRef) charsFromJString :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JChars) bytesFromJString :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JBytes) releaseJChars :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () releaseJBytes :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () jStringToCString :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () getArrayLength :: Ptr JVM -> Ptr JObjectRef -> IO Int32 getObjectClass :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JClassRef) isInstanceOf :: Ptr JVM -> Ptr JObjectRef -> Ptr JClassRef -> IO Bool data JThrowableRef -- | Checks whether an exception has occured in the virtual machine or not. exceptionCheck :: Ptr JVM -> IO Bool -- | Checks whether an exception occured and return that exception. If no -- exception occured, the returned pointer will be the nullPtr. -- This method will return a local reference only, so beware that the -- obtained Ptr will not be valid for too long. exceptionOccurred :: Ptr JVM -> IO (Ptr JThrowableRef) -- | Checks whether an exception occured and return that exception. If no -- exception occured, the returned pointer will be the nullPtr. -- This method will also call exceptionClear which means that it can not -- be called twice. This method will return a global reference - as -- opposed to exceptionOccurred, which will return a local -- reference only. exceptionOccurredClear :: Ptr JVM -> IO (Ptr JThrowableRef) exceptionClear :: Ptr JVM -> IO () exceptionDescribe :: Ptr JVM -> IO () getDebugStatus :: IO Bool setDebugStatus :: Bool -> IO () -- | Returns the path to libjvm that is used by this library. Note that -- this will return the nullPtr if the library has not yet been -- initialized. The library is lazily initialized the first time that -- runJava' is used. runJava is implemented in terms of -- runJava, as is initJava. -- -- You are not allowed to invoke free on the returned cstring. getLibjvmPath :: IO CString -- | Returns the path to libjvm with which this library has been compiled. -- This is guaranteed to never return nullPtr. -- -- You are not allowed to invoke free on the returned cstring. getCompiledLibjvmPath :: IO CString -- | Sets the path to libjvm. Note that this will only have an effect if -- the library has not yet been initialized, that is before any of the -- following functions is used: runJava, runJava', and -- initJava. -- -- Do not invoke free on the cstring passed to this function, as -- this function will not set a copy but the object given. It is only -- ever used once during the lifecycle of your application. setLibjvmPath :: CString -> IO () registerCallbacks :: Ptr JVM -> Ptr JClassRef -> IO Bool data Z Z :: Z data C C :: C data B B :: B data S S :: S data I I :: I data J J :: J data D D :: D data F F :: F data L L :: String -> L data V V :: V data A x A :: x -> A x data X X :: X runCocoaMain :: IO () instance ReleaseGlobalReference JThrowableRef instance ReleaseGlobalReference JClassRef instance ReleaseGlobalReference JObjectRef -- | Low level interface to the Java Virtual Machine. This module is a very -- thin wrapper over the Java Native Interface. -- -- Note that all functions that return references (of type Ptr -- JObjectRef) return global references which you will need to free -- manually. -- -- This module contains safe bindings, see also -- Foreign.Java.JNI.Unsafe. -- -- Read the The Java Native Interface - Programmer's Guide and -- Specification for further information on the Java Native Interface -- (available at -- http://www.soi.city.ac.uk/~kloukin/IN2P3/material/jni.pdf, and -- http://192.9.162.55/docs/books/jni/). module Foreign.Java.JNI.Safe data JVM createVM :: IO (Ptr JVM) createVM' :: Word32 -> Ptr CString -> IO (Ptr JVM) destroyVM :: Ptr JVM -> IO () persistVM :: Ptr JVM -> IO () data JClassRef findClass :: Ptr JVM -> CString -> IO (Ptr JClassRef) data JConstructorID data JObjectRef getConstructorID :: Ptr JVM -> Ptr JClassRef -> CString -> IO (Ptr JConstructorID) newObject :: Ptr JVM -> Ptr JClassRef -> Ptr JConstructorID -> Ptr JValues -> IO (Ptr JObjectRef) newBooleanArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newCharArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newLongArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newIntArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newShortArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newByteArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newFloatArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newDoubleArray :: Ptr JVM -> Int32 -> Ptr JObjectRef newObjectArray :: Ptr JVM -> Int32 -> Ptr JClass -> Ptr JObjectRef data JStaticMethodID data JMethodID getStaticMethodID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JStaticMethodID) getMethodID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JMethodID) callStaticVoidMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO () callStaticBooleanMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Bool callStaticCharMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Word16 callStaticByteMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int8 callStaticShortMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int16 callStaticIntMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int32 callStaticLongMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO Int64 callStaticFloatMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CFloat callStaticDoubleMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CDouble callStaticObjectMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO (Ptr JObjectRef) callStaticStringMethod :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticMethodID -> Ptr JValues -> IO CString callVoidMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO () callBooleanMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Bool callCharMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Word16 callByteMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int8 callShortMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int16 callIntMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int32 callLongMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO Int64 callFloatMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CFloat callDoubleMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CDouble callObjectMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO (Ptr JObjectRef) callStringMethod :: Ptr JVM -> Ptr JObjectRef -> Ptr JMethodID -> Ptr JValues -> IO CString data JFieldID data JStaticFieldID getFieldID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JFieldID) getStaticFieldID :: Ptr JVM -> Ptr JClassRef -> CString -> CString -> IO (Ptr JStaticFieldID) getStaticBooleanField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Bool getStaticCharField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Word16 getStaticByteField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int8 getStaticShortField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int16 getStaticIntField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int32 getStaticLongField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO Int64 getStaticFloatField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CFloat getStaticDoubleField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CDouble getStaticObjectField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO (Ptr JObjectRef) getStaticStringField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> IO CString setStaticBooleanField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Bool -> IO () setStaticCharField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Word16 -> IO () setStaticByteField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int8 -> IO () setStaticShortField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int16 -> IO () setStaticIntField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int32 -> IO () setStaticLongField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Int64 -> IO () setStaticFloatField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CFloat -> IO () setStaticDoubleField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CDouble -> IO () setStaticObjectField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> Ptr JObjectRef -> IO () setStaticStringField :: Ptr JVM -> Ptr JClassRef -> Ptr JStaticFieldID -> CString -> IO () getBooleanField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Bool getCharField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Word16 getByteField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int8 getShortField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int16 getIntField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int32 getLongField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO Int64 getFloatField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CFloat getDoubleField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CDouble getObjectField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO (Ptr JObjectRef) getStringField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> IO CString setBooleanField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Bool -> IO () setCharField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Word16 -> IO () setByteField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int8 -> IO () setShortField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int16 -> IO () setIntField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int32 -> IO () setLongField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Int64 -> IO () setFloatField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CFloat -> IO () setDoubleField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CDouble -> IO () setObjectField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> Ptr JObjectRef -> IO () setStringField :: Ptr JVM -> Ptr JObjectRef -> Ptr JFieldID -> CString -> IO () data JValues data JArg BooleanA :: Bool -> JArg CharA :: Word16 -> JArg ByteA :: Int8 -> JArg ShortA :: Int16 -> JArg IntA :: Int32 -> JArg LongA :: Int64 -> JArg FloatA :: Float -> JArg DoubleA :: Double -> JArg StringA :: String -> JArg ObjectA :: (Maybe JObject) -> JArg ArrayA :: (Maybe (JArray e)) -> JArg -- | Create a JValues Array which can be used for argument passing to a -- multi parameter method. You need to free the Ptr object manually using -- free. -- -- This method is implemented using calloc internally. See the -- native implementation of newJValues. mkJValues :: Ptr JVM -> [JArg] -> IO (Ptr JValues) newJValues :: CInt -> IO (Ptr JValues) setJValueByte :: Ptr JValues -> CInt -> Int8 -> IO () setJValueShort :: Ptr JValues -> CInt -> Int16 -> IO () setJValueInt :: Ptr JValues -> CInt -> Int32 -> IO () setJValueLong :: Ptr JValues -> CInt -> Int64 -> IO () setJValueFloat :: Ptr JValues -> CInt -> CFloat -> IO () setJValueDouble :: Ptr JValues -> CInt -> CDouble -> IO () setJValueObject :: Ptr JValues -> CInt -> Ptr JObjectRef -> IO () setJValueString :: Ptr JVM -> Ptr JValues -> CInt -> CString -> IO () releaseJObjectRef :: Ptr JVM -> Ptr JObjectRef -> IO () releaseJClassRef :: Ptr JVM -> Ptr JClassRef -> IO () releaseJThrowableRef :: Ptr JVM -> Ptr JThrowableRef -> IO () -- | release is a special function which can be used to create a -- ForeignPtr. A ForeignPtr does not carry a reference to a -- virtual machine (no Ptr JVM), thus this function will lookup -- the current virtual machine or do nothing if it can not find one. It -- is realised as a FunPtr as this is what newForeignPtr -- expects. release :: ReleaseGlobalReference a => FunPtr (Ptr a -> IO ()) data JChars data JBytes newJString :: Ptr JVM -> CString -> IO (Ptr JObjectRef) charsFromJString :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JChars) bytesFromJString :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JBytes) releaseJChars :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () releaseJBytes :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () jStringToCString :: Ptr JVM -> Ptr JObjectRef -> CString -> IO () getArrayLength :: Ptr JVM -> Ptr JObjectRef -> IO Int32 getObjectClass :: Ptr JVM -> Ptr JObjectRef -> IO (Ptr JClassRef) isInstanceOf :: Ptr JVM -> Ptr JObjectRef -> Ptr JClassRef -> IO Bool data JThrowableRef -- | Checks whether an exception has occured in the virtual machine or not. exceptionCheck :: Ptr JVM -> IO Bool -- | Checks whether an exception occured and return that exception. If no -- exception occured, the returned pointer will be the nullPtr. -- This method will return a local reference only, so beware that the -- obtained Ptr will not be valid for too long. exceptionOccurred :: Ptr JVM -> IO (Ptr JThrowableRef) -- | Checks whether an exception occured and return that exception. If no -- exception occured, the returned pointer will be the nullPtr. -- This method will also call exceptionClear which means that it can not -- be called twice. This method will return a global reference - as -- opposed to exceptionOccurred, which will return a local -- reference only. exceptionOccurredClear :: Ptr JVM -> IO (Ptr JThrowableRef) exceptionClear :: Ptr JVM -> IO () exceptionDescribe :: Ptr JVM -> IO () getDebugStatus :: IO Bool setDebugStatus :: Bool -> IO () -- | Returns the path to libjvm that is used by this library. Note that -- this will return the nullPtr if the library has not yet been -- initialized. The library is lazily initialized the first time that -- runJava' is used. runJava is implemented in terms of -- runJava, as is initJava. -- -- You are not allowed to invoke free on the returned cstring. getLibjvmPath :: IO CString -- | Returns the path to libjvm with which this library has been compiled. -- This is guaranteed to never return nullPtr. -- -- You are not allowed to invoke free on the returned cstring. getCompiledLibjvmPath :: IO CString -- | Sets the path to libjvm. Note that this will only have an effect if -- the library has not yet been initialized, that is before any of the -- following functions is used: runJava, runJava', and -- initJava. -- -- Do not invoke free on the cstring passed to this function, as -- this function will not set a copy but the object given. It is only -- ever used once during the lifecycle of your application. setLibjvmPath :: CString -> IO () registerCallbacks :: Ptr JVM -> Ptr JClassRef -> IO Bool data Z Z :: Z data C C :: C data B B :: B data S S :: S data I I :: I data J J :: J data D D :: D data F F :: F data L L :: String -> L data V V :: V data A x A :: x -> A x data X X :: X runCocoaMain :: IO () instance ReleaseGlobalReference JThrowableRef instance ReleaseGlobalReference JClassRef instance ReleaseGlobalReference JObjectRef -- | This module contains information about the java bridge on your system. -- For the low level interface use Foreign.Java.JNI.Safe or -- Foreign.Java.JNI.Unsafe, for the medium level interface use -- Foreign.Java. -- -- For creating high level bindings between Haskell and Java use -- Foreign.Java.Bindings. module Foreign.Java.JNI data JniFlag -- | The java bridge was compiled with only the core modules (low level -- interface). ONLY_CORE :: JniFlag -- | The java bridge was compiled with debug symbols. DEBUG :: JniFlag -- | The java bridge was compiled with special support for Cocoa on Mac OS -- X. OSX_GUI :: JniFlag -- | The java bridge was linked with the Java framework on OS X. Otherwise -- libjvm is loaded dynamically. OSX_FRAMEWORK :: JniFlag -- | Returns a list of flags which the java bridge was compiled with. jniFlags :: [JniFlag] -- | The version of the java bridge. javaBridgeVersion :: String instance Show JniFlag instance Eq JniFlag -- | The ternary value type, which can treither hold a value, -- nothing, or a special value describing an error condition. module Foreign.Java.Value -- | A ternary value type to hold one of two possible value types or none -- at all. data Value e a -- | An actual value Value :: a -> Value e a -- | No value NoValue :: Value e a -- | A value describing the error Fail :: e -> Value e a -- | fold on a Value, like either for Either or -- maybe for Maybe. value :: b -> (e -> b) -> (a -> b) -> Value e a -> b -- | This module contains the medium level interface to the Java Bridge. -- -- See Foreign.Java.JNI.Safe and Foreign.Java.JNI.Unsafe -- for the low level interface which is a plain translation of the Java -- Native Interface. Information about the library can be retrieved using -- Foreign.Java.JNI. -- -- High level bindings can be generated using -- Foreign.Java.Bindings. module Foreign.Java -- | Every computation in the Java Virtual Machine happens inside the Java -- monad. The Java monad is mightier than the IO monad, i.e. IO -- operations can be performed in both the IO monad as well as in the -- Java monad, but Java operations can be performed in the Java monad -- only and not in the IO monad. -- -- Use one of runJava or runJava' to perform operations in -- the Java monad. data Java a -- | Run a computation with support by a Java Virtual Machine. runJava :: Java a -> IO a -- | Run a computation with support by a Java Virtual Machine, initialized -- with the given parameters. -- -- This function may be used only once. If you intend to call it multiple -- times, you need to initialize the Java subsystem once before. If you -- fail to do so, this function will tear down the virtual machine once -- it is done. -- -- By using initJava the virtual machine will be alive during the -- whole lifetime of your process and runJava' will never tear -- down the machine. -- -- NOTE: According to the Java Native Interface specification it may -- be possible to create multiple virtual machines within a single -- process. However, no implementation of the JNI seems to be capable of -- doing so. -- -- This function can be used to set for example the classpath of the -- virtual machine: -- --
--   runJava' ["-Djava.class.path=java-library-dir"] $ do
--       doSomething
--   
-- -- NOTE: java.class.path does support relative paths. runJava' :: [String] -> Java a -> IO a -- | Initializes the Java Virtual Machine so that it can be used by -- subsequent invocations of runJava. Note that once you start the -- virtual machine it will be runing throughout the whole lifetime of the -- main thread of your application. initJava :: [String] -> IO () -- | By default java methods are invoked via the FFI using safe calls. Safe -- calls are slower than unsafe calls. This function controls whether -- safe or unsafe calls are being used to communicate with the JVM. -- -- If your application does not invoke the JVM concurrently it is mostly -- safe to use unsafe calls. -- --
--   runJava (setUnsafe True >> doSomething)
--   
-- -- will perform doSomething using unsafe calls. setUnsafe :: MonadState JVMState m => Bool -> m () -- | Short hand for runJavaGui' []. runJavaGui :: Java a -> IO () -- | Mac OS X needs some special treatment for initializing graphical -- applications, namely a Cocoa Runloop needs to be present on the main -- thread. Since the main thread is the application that the JVM was -- invoked from this has two consequences: (1) A runloop needs to be -- created on the main thread manually and (2) the main thread is not -- usable for your application. -- -- On Mac OS X this function will fork an os thread using forkJava -- and start the Cocoa main event loop. This means that this function -- must be called on the main thread and that it will never terminate -- (since the cocoa event queue will be running there forever). -- -- Note that this implies that you link your application with the -- threaded runtime (`-threaded` in GHC). -- -- Typically your application should look like this: -- --
--   main = runJavaGui $ do
--       stuffYourApplicationDoes
--   
-- -- On all other platforms this is exactly the same as runJava' -- (minus the fact that it returns ()). runJavaGui' :: [String] -> Java a -> IO () -- | Finds and loads a class. -- -- Note that this function can indeed fail with an exception and may -- execute code from the class to be loaded inside the virtual machine. -- -- This is due to the fact that getClass is a translation of the -- findClass function in the JNI which loads *and* resolves the -- class. If you want to get a class definition without resolving the -- class, use the method loadClass(String,boolean) on a -- ClassLoader. -- -- Here is an example of how to do that: -- --
--   main' = runJava $ do
--       (Just classLoader) <- getClass "java.lang.ClassLoader"
--       getSystemClassLoader <- classLoader `bindStaticMethod` "getSystemClassLoader"
--           ::= object "java.lang.ClassLoader"
--       (Just systemClassLoader) <- getSystemClassLoader
--   
--       loadClass <- classLoader `bindMethod` "loadClass"
--           ::= string --> boolean --> object "java.lang.Class"
--       (Just clazz) <- loadClass systemClassLoader "java.awt.EventQueue" False
--       io$ print clazz
--   
getClass :: String -> Java (Maybe JClass) getConstructor :: (Monad m, Constructor (a -> String)) => JClass -> a -> Java (m (JConstructor a)) newObject :: JClass -> Java (Maybe JObject) newObjectE :: JClass -> Java (Either JThrowable (Maybe JObject)) newObjectX :: JClass -> Java (Maybe JObject) newObjectFrom :: NewObject p b => JConstructor p -> b newObjectFromE :: NewObjectE p b => JConstructor p -> b newObjectFromX :: NewObjectX p b => JConstructor p -> b getMethod :: Method (p -> String) => JClass -> MethodDescriptor p -> Java (Maybe (JMethod p)) getStaticMethod :: Method (p -> String) => JClass -> MethodDescriptor p -> Java (Maybe (JStaticMethod p)) bindMethod :: (Method (p -> String), MethodCall p b) => JClass -> MethodDescriptor p -> Java (JObject -> b) bindStaticMethod :: (Method (p -> String), StaticCall p b) => JClass -> MethodDescriptor p -> Java b callMethod :: MethodCall p b => JMethod p -> JObject -> b callMethodE :: MethodCallE p b => JMethod p -> JObject -> b callMethodX :: MethodCallX p b => JMethod p -> JObject -> b callStaticMethod :: StaticCall p b => JStaticMethod p -> b callStaticMethodE :: StaticCallE p b => JStaticMethod p -> b callStaticMethodX :: StaticCallX p b => JStaticMethod p -> b getField :: Param a => JClass -> String -> a -> Java (Maybe (JField a)) getStaticField :: Param a => JClass -> String -> a -> Java (Maybe (JStaticField a)) readField :: Field a b => JField a -> JObject -> Java b readStaticField :: Field a b => JStaticField a -> Java b writeField :: Field a b => JField a -> JObject -> b -> Java () writeStaticField :: Field a b => JStaticField a -> b -> Java () -- | Return the length of an JArray. arrayLength :: JArray e -> Java Int32 class JavaArray e a | e -> a where toList arr@(JArray size _) = forM [0 .. size - 1] (arr `at`) at :: JavaArray e a => JArray e -> Int32 -> Java a write :: JavaArray e a => JArray e -> Int32 -> a -> Java () toList :: JavaArray e a => JArray e -> Java [a] -- | Provides basic functions that every Java Object supports. There are -- instances for JObject, JClass, JThrowable, and -- JArray (which are all references to objects in the virtual -- machine). -- -- Minimal complete definition: asObject. class JavaObject a where toString obj = asObject obj >>= toString hashCode obj = asObject obj >>= hashCode classOf obj = asObject obj >>= classOf equals this obj = do { this' <- asObject this; object <- asObject obj; this' `equals` object } toString :: JavaObject a => a -> Java String hashCode :: JavaObject a => a -> Java Int32 asObject :: JavaObject a => a -> Java JObject classOf :: JavaObject a => a -> Java JClass equals :: (JavaObject a, JavaObject b) => a -> b -> Java Bool -- | Check whether the given object is an instance of the given class. isInstanceOf :: JObject -> JClass -> Java Bool -- | Short for liftIO and restricted to the Java monad. io :: IO a -> Java a -- | Lift a computation from the IO monad. liftIO :: MonadIO m => forall a. IO a -> m a -- | A utility function for forking an OS thread which runs in the Java -- Monad. It will return a JavaThreadId which you can wait on -- using waitJava. forkJava :: Java a -> Java (JavaThreadId a) -- | Wait for a Java Thread to exit. If the thread exits abnormally (that -- is, if an exception occurred), this function will return Left -- SomeException. Otherwise it will return the result of the -- computation as Right a. waitJava :: JavaThreadId a -> Java (Either SomeException a) -- | A reference to an instance of a Java Virtual Machine. data JVM -- | A reference to a Class object. data JClass -- | A reference to an arbitrary Object. data JObject -- | A reference to an Array in the JVM. data JArray e data JField a data JStaticField a data JMethod a data JStaticMethod a data JConstructor a -- | A reference to an Exception. data JThrowable data JavaThreadId a data MethodDescriptor p (::=) :: String -> p -> MethodDescriptor p (-->) :: a -> x -> P a x void :: V boolean :: Z char :: C byte :: B short :: S int :: I long :: J float :: F double :: D object :: String -> L string :: X array :: x -> A x instance Show a => Show (JConstructor a) instance Show ConstructorH instance Show a => Show (JStaticMethod a) instance Show a => Show (JMethod a) instance Show StaticH instance Show MethodH instance Show (JField a) instance Show (JStaticField a) instance Field L (Maybe JObject) instance Field F Float instance Field D Double instance Field J Int64 instance Field I Int32 instance Field S Int16 instance Field B Int8 instance Field C Word16 instance Field Z Bool instance MethodCallX (A e) (Java (Maybe (JArray e))) instance MethodCallE (A e) (Java (Either JThrowable (Maybe (JArray e)))) instance MethodCall (A e) (Java (Maybe (JArray e))) instance MethodCallX Q (Java (Maybe JObject)) instance MethodCallE Q (Java (Either JThrowable (Maybe JObject))) instance MethodCall Q (Java (Maybe JObject)) instance MethodCallX L (Java (Maybe JObject)) instance MethodCallE L (Java (Either JThrowable (Maybe JObject))) instance MethodCall L (Java (Maybe JObject)) instance MethodCallX X (Java (Maybe String)) instance MethodCallE X (Java (Either JThrowable (Maybe String))) instance MethodCall X (Java (Maybe String)) instance MethodCallX D (Java Double) instance MethodCallE D (Java (Either JThrowable Double)) instance MethodCall D (Java Double) instance MethodCallX F (Java Float) instance MethodCallE F (Java (Either JThrowable Float)) instance MethodCall F (Java Float) instance MethodCallX J (Java Int64) instance MethodCallE J (Java (Either JThrowable Int64)) instance MethodCall J (Java Int64) instance MethodCallX I (Java Int32) instance MethodCallE I (Java (Either JThrowable Int32)) instance MethodCall I (Java Int32) instance MethodCallX S (Java Int16) instance MethodCallE S (Java (Either JThrowable Int16)) instance MethodCall S (Java Int16) instance MethodCallX B (Java Int8) instance MethodCallE B (Java (Either JThrowable Int8)) instance MethodCall B (Java Int8) instance MethodCallX C (Java Word16) instance MethodCallE C (Java (Either JThrowable Word16)) instance MethodCall C (Java Word16) instance MethodCallX Z (Java Bool) instance MethodCallE Z (Java (Either JThrowable Bool)) instance MethodCall Z (Java Bool) instance MethodCallX V (Java ()) instance MethodCallE V (Java (Either JThrowable ())) instance MethodCall V (Java ()) instance (JArg t v, MethodCallX x b) => MethodCallX (P t x) (v -> b) instance (JArg t v, MethodCallE x b) => MethodCallE (P t x) (v -> b) instance (JArg t v, MethodCall x b) => MethodCall (P t x) (v -> b) instance StaticCallX (A e) (Java (Maybe (JArray e))) instance StaticCallE (A e) (Java (Either JThrowable (Maybe (JArray e)))) instance StaticCall (A e) (Java (Maybe (JArray e))) instance StaticCallX Q (Java (Maybe JObject)) instance StaticCallE Q (Java (Either JThrowable (Maybe JObject))) instance StaticCall Q (Java (Maybe JObject)) instance StaticCallX L (Java (Maybe JObject)) instance StaticCallE L (Java (Either JThrowable (Maybe JObject))) instance StaticCall L (Java (Maybe JObject)) instance StaticCallX X (Java (Maybe String)) instance StaticCallE X (Java (Either JThrowable (Maybe String))) instance StaticCall X (Java (Maybe String)) instance StaticCallX D (Java Double) instance StaticCallE D (Java (Either JThrowable Double)) instance StaticCall D (Java Double) instance StaticCallX F (Java Float) instance StaticCallE F (Java (Either JThrowable Float)) instance StaticCall F (Java Float) instance StaticCallX J (Java Int64) instance StaticCallE J (Java (Either JThrowable Int64)) instance StaticCall J (Java Int64) instance StaticCallX I (Java Int32) instance StaticCallE I (Java (Either JThrowable Int32)) instance StaticCall I (Java Int32) instance StaticCallX S (Java Int16) instance StaticCallE S (Java (Either JThrowable Int16)) instance StaticCall S (Java Int16) instance StaticCallX B (Java Int8) instance StaticCallE B (Java (Either JThrowable Int8)) instance StaticCall B (Java Int8) instance StaticCallX C (Java Word16) instance StaticCallE C (Java (Either JThrowable Word16)) instance StaticCall C (Java Word16) instance StaticCallX Z (Java Bool) instance StaticCallE Z (Java (Either JThrowable Bool)) instance StaticCall Z (Java Bool) instance StaticCallX V (Java ()) instance StaticCallE V (Java (Either JThrowable ())) instance StaticCall V (Java ()) instance (JArg t v, StaticCallX x b) => StaticCallX (P t x) (v -> b) instance (JArg t v, StaticCallE x b) => StaticCallE (P t x) (v -> b) instance (JArg t v, StaticCall x b) => StaticCall (P t x) (v -> b) instance NewObjectE (A e) (Maybe (JArray e) -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX (A e) (Maybe (JArray e) -> Java (Maybe JObject)) instance NewObject (A e) (Maybe (JArray e) -> Java (Maybe JObject)) instance NewObjectE X (String -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX X (String -> Java (Maybe JObject)) instance NewObject X (String -> Java (Maybe JObject)) instance NewObjectE Q (Maybe JObject -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX Q (Maybe JObject -> Java (Maybe JObject)) instance NewObject Q (Maybe JObject -> Java (Maybe JObject)) instance NewObjectE L (Maybe JObject -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX L (Maybe JObject -> Java (Maybe JObject)) instance NewObject L (Maybe JObject -> Java (Maybe JObject)) instance NewObjectE D (Double -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX D (Double -> Java (Maybe JObject)) instance NewObject D (Double -> Java (Maybe JObject)) instance NewObjectE F (Float -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX F (Float -> Java (Maybe JObject)) instance NewObject F (Float -> Java (Maybe JObject)) instance NewObjectE J (Int64 -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX J (Int64 -> Java (Maybe JObject)) instance NewObject J (Int64 -> Java (Maybe JObject)) instance NewObjectE I (Int32 -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX I (Int32 -> Java (Maybe JObject)) instance NewObject I (Int32 -> Java (Maybe JObject)) instance NewObjectE S (Int16 -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX S (Int16 -> Java (Maybe JObject)) instance NewObject S (Int16 -> Java (Maybe JObject)) instance NewObjectE B (Int8 -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX B (Int8 -> Java (Maybe JObject)) instance NewObject B (Int8 -> Java (Maybe JObject)) instance NewObjectE C (Word16 -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX C (Word16 -> Java (Maybe JObject)) instance NewObject C (Word16 -> Java (Maybe JObject)) instance NewObjectE Z (Bool -> Java (Either JThrowable (Maybe JObject))) instance NewObjectX Z (Bool -> Java (Maybe JObject)) instance NewObject Z (Bool -> Java (Maybe JObject)) instance (JArg t v, NewObjectX x b) => NewObjectX (P t x) (v -> b) instance (JArg t v, NewObjectE x b) => NewObjectE (P t x) (v -> b) instance (JArg t v, NewObject x b) => NewObject (P t x) (v -> b) instance JavaArray (A e) (Maybe (JArray e)) instance JavaArray L (Maybe JObject) instance JavaObject (JArray F) instance JavaArray F Float instance JavaObject (JArray D) instance JavaArray D Double instance JavaObject (JArray J) instance JavaArray J Int64 instance JavaObject (JArray I) instance JavaArray I Int32 instance JavaObject (JArray S) instance JavaArray S Int16 instance JavaObject (JArray B) instance JavaArray B Int8 instance JavaObject (JArray C) instance JavaArray C Word16 instance JavaObject (JArray Z) instance JavaArray Z Bool instance JavaObject JThrowable instance JavaObject JClass instance JavaObject (JArray L) instance JavaObject JObject -- | This module provides type classes and instances for supporting the -- high level bindings. This module should not be imported directly. module Foreign.Java.Bindings object' :: String -> Q class JBoolean a toBoolean :: JBoolean a => a -> Java Bool class JChar a toChar :: JChar a => a -> Java Word16 class JByte a toByte :: JByte a => a -> Java Int8 class JShort a toShort :: JShort a => a -> Java Int16 class JInt a toInt :: JInt a => a -> Java Int32 class JLong a toLong :: JLong a => a -> Java Int64 class JFloat a toFloat :: JFloat a => a -> Java Float class JDouble a toDouble :: JDouble a => a -> Java Double class Array a asMaybeArrayObject :: Array a => a -> Java (Maybe JObject) -- | The result of a function call that is of type boolean. class BooleanResult m toBooleanResult :: BooleanResult m => Either JThrowable Bool -> Java m -- | The result of a function call that is of type char. class CharResult m toCharResult :: CharResult m => Either JThrowable Word16 -> Java m -- | The result of a function call that is of type byte. class ByteResult m toByteResult :: ByteResult m => Either JThrowable Int8 -> Java m -- | The result of a function call that is of type short. class ShortResult m toShortResult :: ShortResult m => Either JThrowable Int16 -> Java m -- | The result of a function call that is of type int. class IntResult m toIntResult :: IntResult m => Either JThrowable Int32 -> Java m -- | The result of a function call that is of type long. class LongResult m toLongResult :: LongResult m => Either JThrowable Int64 -> Java m -- | The result of a function call that is of type float. class FloatResult m toFloatResult :: FloatResult m => Either JThrowable Float -> Java m -- | The result of a function call that is of type double. class DoubleResult m toDoubleResult :: DoubleResult m => Either JThrowable Double -> Java m -- | The result of a function call that is of type void. class VoidResult m toVoidResult :: VoidResult m => Either JThrowable () -> Java m -- | An array result of a function call. class JavaArray (ArrayResultType m) (ArrayResultComponent m) => ArrayResult m where type family ArrayResultType m type family ArrayResultComponent m toArrayResult :: ArrayResult m => Either JThrowable (Maybe (JArray (ArrayResultType m))) -> Java m -- | The result of a function call that is of type object. class ObjectResult m toObjectResult :: ObjectResult m => Either JThrowable (Maybe JObject) -> Java m -- | A convenient alternative to isInstanceOf. -- -- Minimal complete definition: coerce or whenInstanceOf. class InstanceOf a where type family CoercedType a instanceOf o t = whenInstanceOf o t (return . const ()) >>= return . maybe False (const True) whenInstanceOf o t a = coerce o t >>= maybe (return Nothing) (fmap Just . a) coerce o t = whenInstanceOf o t return instanceOf :: (InstanceOf a, JavaObject o) => o -> a -> Java Bool whenInstanceOf :: (InstanceOf a, JavaObject o) => o -> a -> (CoercedType a -> Java d) -> Java (Maybe d) coerce :: (InstanceOf a, JavaObject o) => o -> a -> Java (Maybe (CoercedType a)) -- | For INTERNAL use only. Is however not in a hidden module, so that -- other libraries can link against it. class UnsafeCast a unsafeFromJObject :: UnsafeCast a => JObject -> Java a -- | Yepp. Register callbacks. Do it. registerCallbacks :: JClass -> Java Bool -- | A wrapped function can be used as a callback from the JVM into the -- Haskell runtime environment. type WrappedFun = Ptr JVM -> Ptr JObjectRef -> Ptr JObjectRef -> Ptr JObjectRef -> IO (Ptr JObjectRef) runJava_ :: Ptr JVM -> Java a -> IO a wrap_ :: WrappedFun -> IO (FunPtr WrappedFun) freeFunPtr :: FunPtr WrappedFun -> IO () wrap :: Java () -> IO (FunPtr WrappedFun) intify :: Java () -> IO Int64 sushimaki :: String -> Java () -> Java JObject delete :: JObject -> Java () instance ObjectResult [Char] instance UnsafeCast a => ObjectResult (Maybe a) instance UnsafeCast a => ObjectResult (Either JThrowable (Maybe a)) instance UnsafeCast a => ObjectResult (Either (Maybe JThrowable) a) instance UnsafeCast a => ObjectResult (Value JThrowable a) instance ArrayResult [String] instance ArrayResult [Char] instance ArrayResult [Double] instance ArrayResult [Float] instance ArrayResult [Int64] instance ArrayResult [Int32] instance ArrayResult [Int16] instance ArrayResult [Int8] instance ArrayResult [Word16] instance ArrayResult [Bool] instance ArrayResult a => ArrayResult (Either JThrowable a) instance VoidResult (Maybe JThrowable) instance VoidResult (Either JThrowable ()) instance VoidResult () instance DoubleResult (Either JThrowable Double) instance DoubleResult Double instance FloatResult (Either JThrowable Float) instance FloatResult Float instance LongResult (Either JThrowable Int64) instance LongResult Int64 instance IntResult (Either JThrowable Int32) instance IntResult Int32 instance ShortResult (Either JThrowable Int16) instance ShortResult Int16 instance ByteResult (Either JThrowable Int8) instance ByteResult Int8 instance CharResult (Either JThrowable Word16) instance CharResult Word16 instance BooleanResult (Either JThrowable Bool) instance BooleanResult Bool instance JDouble Double instance JDouble CDouble instance JFloat Float instance JFloat CFloat instance JLong Int64 instance JLong Word32 instance JLong Int32 instance JLong Word16 instance JLong Int16 instance JLong Word8 instance JLong Int8 instance JLong Int instance JInt Int32 instance JInt Word16 instance JInt Int16 instance JInt Word8 instance JInt Int8 instance JInt Int instance JShort Int16 instance JShort Word8 instance JShort Int8 instance JByte Int8 instance JChar Word16 instance JChar Int8 instance JChar Char instance JBoolean Bool