Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data JType
- class SingI ty => IsPrimitiveType (ty :: JType)
- class IsReferenceType (ty :: JType)
- type family Sing :: k -> Type
- data SJType (a :: JType) where
- type (<>) a g = 'Generic a g
- newtype J (a :: JType) = J (ForeignPtr (J a))
- jnull :: J a
- upcast :: J a -> JObject
- arrayUpcast :: IsReferenceType ty => J ('Array ty) -> JObjectArray
- unsafeCast :: J a -> J b
- generic :: J a -> J (a <> g)
- unsafeUngeneric :: J (a <> g) -> J a
- jtypeOf :: JValue -> SomeSing JType
- data ReferenceTypeName
- singToIsReferenceType :: Sing (ty :: JType) -> Maybe (Dict (IsReferenceType ty))
- referenceTypeName :: IsReferenceType ty => Sing (ty :: JType) -> ReferenceTypeName
- data Signature
- signature :: Sing (ty :: JType) -> Signature
- data MethodSignature
- methodSignature :: [SomeSing JType] -> Sing (ty :: JType) -> MethodSignature
- newtype JVM = JVM_ (Ptr JVM)
- newtype JNIEnv = JNIEnv_ (Ptr JNIEnv)
- newtype JMethodID = JMethodID_ (Ptr JMethodID)
- newtype JFieldID = JFieldID_ (Ptr JFieldID)
- data JValue
- withJValues :: [JValue] -> (Ptr JValue -> IO a) -> IO a
- objectFromPtr :: Ptr (J a) -> IO (J a)
- unsafeObjectToPtr :: J a -> Ptr (J a)
- type JObject = J ('Class "java.lang.Object")
- type JClass = J ('Class "java.lang.Class")
- type JString = J ('Class "java.lang.String")
- type JArray a = J ('Array a)
- type JObjectArray = JArray ('Class "java.lang.Object")
- type JBooleanArray = JArray ('Prim "boolean")
- type JByteArray = JArray ('Prim "byte")
- type JCharArray = JArray ('Prim "char")
- type JShortArray = JArray ('Prim "short")
- type JIntArray = JArray ('Prim "int")
- type JLongArray = JArray ('Prim "long")
- type JFloatArray = JArray ('Prim "float")
- type JDoubleArray = JArray ('Prim "double")
- type JThrowable = J ('Class "java.lang.Throwable")
- type JByteBuffer = J ('Class "java.nio.ByteBuffer")
- jniCtx :: Context
Documentation
Not part of the JNI. The kind of J
type indices. Useful to reflect the
object's class at the type-level.
Class Symbol | Class name |
Iface Symbol | Interface name |
Prim Symbol | Primitive type |
Array JType | Array type |
Generic JType [JType] | Parameterized (generic) type |
Void | Void special type |
Instances
SingI 'Void Source # | |
Defined in Foreign.JNI.Types | |
(KnownSymbol sym, SingI sym) => SingI ('Class sym :: JType) Source # | |
Defined in Foreign.JNI.Types | |
(KnownSymbol sym, SingI sym) => SingI ('Iface sym :: JType) Source # | |
Defined in Foreign.JNI.Types | |
(KnownSymbol sym, SingI sym) => SingI ('Prim sym :: JType) Source # | |
Defined in Foreign.JNI.Types | |
SingI ty => SingI ('Array ty :: JType) Source # | |
Defined in Foreign.JNI.Types | |
(SingI ty, SingI tys) => SingI ('Generic ty tys :: JType) Source # | |
Defined in Foreign.JNI.Types | |
type Sing Source # | |
Defined in Foreign.JNI.Types |
class SingI ty => IsPrimitiveType (ty :: JType) Source #
The class of Java types that are "unboxed".
Instances
KnownSymbol sym => IsPrimitiveType ('Prim sym) Source # | |
Defined in Foreign.JNI.Types |
class IsReferenceType (ty :: JType) Source #
Instances
IsReferenceType ('Class sym) Source # | |
Defined in Foreign.JNI.Types | |
IsReferenceType ('Iface sym) Source # | |
Defined in Foreign.JNI.Types | |
IsReferenceType ('Array ty) Source # | |
Defined in Foreign.JNI.Types | |
IsReferenceType ty => IsReferenceType ('Generic ty tys) Source # | |
Defined in Foreign.JNI.Types |
type family Sing :: k -> Type #
Instances
JNI types
arrayUpcast :: IsReferenceType ty => J ('Array ty) -> JObjectArray Source #
Any array of a reference type can be casted to an array of Object
s.
unsafeCast :: J a -> J b Source #
Unsafe type cast. Should only be used to downcast.
generic :: J a -> J (a <> g) Source #
Parameterize the type of an object, making its type a generic type.
data ReferenceTypeName Source #
A reference type name is not just any String
, but a fully qualified
identifier well-formed by construction.
Instances
Eq ReferenceTypeName Source # | |
Defined in Foreign.JNI.Internal (==) :: ReferenceTypeName -> ReferenceTypeName -> Bool # (/=) :: ReferenceTypeName -> ReferenceTypeName -> Bool # | |
Ord ReferenceTypeName Source # | |
Defined in Foreign.JNI.Internal compare :: ReferenceTypeName -> ReferenceTypeName -> Ordering # (<) :: ReferenceTypeName -> ReferenceTypeName -> Bool # (<=) :: ReferenceTypeName -> ReferenceTypeName -> Bool # (>) :: ReferenceTypeName -> ReferenceTypeName -> Bool # (>=) :: ReferenceTypeName -> ReferenceTypeName -> Bool # max :: ReferenceTypeName -> ReferenceTypeName -> ReferenceTypeName # min :: ReferenceTypeName -> ReferenceTypeName -> ReferenceTypeName # | |
Show ReferenceTypeName Source # | |
Defined in Foreign.JNI.Internal showsPrec :: Int -> ReferenceTypeName -> ShowS # show :: ReferenceTypeName -> String # showList :: [ReferenceTypeName] -> ShowS # |
singToIsReferenceType :: Sing (ty :: JType) -> Maybe (Dict (IsReferenceType ty)) Source #
Produces evidence for IsReferenceType from a `Sing ty`.
referenceTypeName :: IsReferenceType ty => Sing (ty :: JType) -> ReferenceTypeName Source #
The name of a type, suitable for passing to findClass
.
A string representing a signature, well-formed by construction.
signature :: Sing (ty :: JType) -> Signature Source #
Construct a JNI type signature from a Java type.
data MethodSignature Source #
A string representing a method signature, well-formed by construction.
Instances
Eq MethodSignature Source # | |
Defined in Foreign.JNI.Internal (==) :: MethodSignature -> MethodSignature -> Bool # (/=) :: MethodSignature -> MethodSignature -> Bool # | |
Ord MethodSignature Source # | |
Defined in Foreign.JNI.Internal compare :: MethodSignature -> MethodSignature -> Ordering # (<) :: MethodSignature -> MethodSignature -> Bool # (<=) :: MethodSignature -> MethodSignature -> Bool # (>) :: MethodSignature -> MethodSignature -> Bool # (>=) :: MethodSignature -> MethodSignature -> Bool # max :: MethodSignature -> MethodSignature -> MethodSignature # min :: MethodSignature -> MethodSignature -> MethodSignature # | |
Show MethodSignature Source # | |
Defined in Foreign.JNI.Internal showsPrec :: Int -> MethodSignature -> ShowS # show :: MethodSignature -> String # showList :: [MethodSignature] -> ShowS # |
methodSignature :: [SomeSing JType] -> Sing (ty :: JType) -> MethodSignature Source #
Construct a method's JNI type signature, given the type of the arguments and the return type.
A JVM instance.
The thread-local JNI context. Do not share this object between threads.
Instances
Eq JNIEnv Source # | |
Show JNIEnv Source # | |
Storable JNIEnv Source # | |
NFData JNIEnv Source # | |
Defined in Foreign.JNI.Types |
A thread-local reference to a method of an object.
Instances
Eq JMethodID Source # | |
Show JMethodID Source # | |
Storable JMethodID Source # | |
Defined in Foreign.JNI.Types | |
NFData JMethodID Source # | |
Defined in Foreign.JNI.Types |
A thread-local reference to a field of an object.
Instances
Eq JFieldID Source # | |
Show JFieldID Source # | |
Storable JFieldID Source # | |
NFData JFieldID Source # | |
Defined in Foreign.JNI.Types |
A union type for uniformly passing arguments to methods.
withJValues :: [JValue] -> (Ptr JValue -> IO a) -> IO a Source #
withJValue jvalues f
provides a pointer to an array containing the given
jvalues
.
The array is valid only while evaluating f
.
Conversions
unsafeObjectToPtr :: J a -> Ptr (J a) Source #
Get a raw pointer to an object. This is unsafe because if the argument is the last usage occurrence of the given foreign pointer, then its finalizer(s) will be run, which potentially invalidates the plain pointer just obtained.
JNI defined object types
type JObjectArray = JArray ('Class "java.lang.Object") Source #
type JBooleanArray = JArray ('Prim "boolean") Source #
type JByteArray = JArray ('Prim "byte") Source #
type JCharArray = JArray ('Prim "char") Source #
type JShortArray = JArray ('Prim "short") Source #
type JLongArray = JArray ('Prim "long") Source #
type JFloatArray = JArray ('Prim "float") Source #
type JDoubleArray = JArray ('Prim "double") Source #
type JThrowable = J ('Class "java.lang.Throwable") Source #
type JByteBuffer = J ('Class "java.nio.ByteBuffer") Source #