java-bridge-0.20130606.3: Bindings to the JNI and a high level interface generator.

Portabilityportable (Haskell2010)
Stabilityprovisional
Maintainerjulian.fleischer@fu-berlin.de
Safe HaskellSafe-Inferred

Foreign.Java.Utils

Description

Utilities for dealing with Class, Package, and Module names in the Java and Haskell languages.

Synopsis

Documentation

makeName :: Maybe String -> String -> StringSource

Build the name of a class based on maybe a package and a class name.

makePackageModuleName :: String -> StringSource

Translates a package name into a module name.

makeClassModuleName :: String -> StringSource

Translates a class name into a module name.

splitClassName :: String -> (String, String)Source

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.

takePackageName :: String -> Maybe StringSource

Retrieve the package name form a simple name of a class.

>>> takePackageName "java.lang.A$B"
Just "java.lang"
>>> takePackageName "Test"
Nothing

takeClassName :: String -> StringSource

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"

takeBaseClassName :: String -> StringSource

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"

takeEnclosingClasses :: String -> [String]Source

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"]