src/codegenlib/java

Source   Edit  

Vars

globalNamespace = "example"
Source   Edit  

Procs

proc addMethodArgument(jmethod: JavaMethodDeclaration; typ: string; name: string) {.
    ...raises: [], tags: [], forbids: [].}
Adds an argument to a method, see tests/test1.nim as an example. Source   Edit  
proc addSnippetToBlock(jb: var JavaBlock; name: string;
                       snippets: openArray[JavaBaseType]) {....raises: [],
    tags: [], forbids: [].}
Adds a Java snippet to a block, see tests/test1.nim as an example. Source   Edit  
proc addSnippetToBlock(jb: var JavaBlock; name: string;
                       snippets: varargs[JavaBaseType]) {....raises: [], tags: [],
    forbids: [].}
Adds a Java snippet to a block, see tests/test1.nim as an example. Source   Edit  
proc addSnippetToMethodBody(jmethod: JavaMethodDeclaration;
                            body: varargs[JavaBaseType]) {....raises: [], tags: [],
    forbids: [].}
Adds a Java snippet to a block, see tests/test1.nim as an example. Source   Edit  
proc constructMethodCall(qualifiedMethodName: string; args: varargs[JavaBase]): string {.
    ...raises: [], tags: [], forbids: [].}
A quick way to create a method call.

Example:

echo constructMethodCall("System.out.println", "Hello world!".jstring)
Source   Edit  
proc imports(jf: var JavaFile; importStmts: varargs[string]) {....raises: [],
    tags: [], forbids: [].}
Allows you to import Java classes (in the generated Java code). Source   Edit  
proc initialiseClass(className: string; args: varargs[JavaBase]): string {.
    ...raises: [], tags: [], forbids: [].}
A way to initialise classes known only as a string.

Example:

echo initialiseClass("String", "Woah!".jstring)
Source   Edit  
proc jc(code: string; suffix = ""): JavaCodeEmission {....raises: [], tags: [],
    forbids: [].}
The raw Java code as a string, could be anything as long as it's valid Source   Edit  
proc newJavaBlock(): JavaBlock {....raises: [], tags: [], forbids: [].}
Creates an empty JavaBlock. Source   Edit  
proc newJavaFile(subpackage: string = ""; namespace: string = ""): JavaFile {.
    ...raises: [], tags: [], forbids: [].}
Creates a JavaFile. Source   Edit  
proc newJavaMethodDeclaration(name: string; returnTyp: string = "void";
                              public: bool = false; statik: bool = false;
                              final: bool = false): JavaMethodDeclaration {.
    ...raises: [], tags: [], forbids: [].}
Creates a new method declaration. Source   Edit  
proc newJavaVariableDeclaration(typ: string; name: string; value: string = "";
                                final: bool = false; public: bool = false;
                                statik: bool = false): JavaVariableDeclaration {.
    ...raises: [], tags: [], forbids: [].}
Creates a new variable declaration. Source   Edit