|
| 1 | +// Type definitions for java 0.5.4 |
| 2 | +// Project: https://github.com/joeferner/java |
| 3 | +// Definitions by: Jim Lloyd <https://github.com/jimlloyd> |
| 4 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped |
| 5 | + |
| 6 | +/// <reference path="../bluebird/bluebird.d.ts" /> |
| 7 | +/// <reference path="../node/node.d.ts" /> |
| 8 | + |
| 9 | +// This is the core API exposed by https://github.com/joeferner/java. |
| 10 | +// To get the full power of Typescript with Java, see https://github.com/RedSeal-co/ts-java. |
| 11 | + |
| 12 | +declare module 'java' { |
| 13 | + var NodeJavaCore: NodeJavaCore.NodeAPI; |
| 14 | + export = NodeJavaCore; |
| 15 | +} |
| 16 | + |
| 17 | +declare module NodeJavaCore { |
| 18 | + export interface Callback<T> { |
| 19 | + (err?: Error, result?: T): void; |
| 20 | + } |
| 21 | + |
| 22 | + interface Promisify { |
| 23 | + (funct: Function, receiver?: any): Function; |
| 24 | + } |
| 25 | + |
| 26 | + interface AsyncOptions { |
| 27 | + syncSuffix: string; |
| 28 | + asyncSuffix?: string; |
| 29 | + promiseSuffix?: string; |
| 30 | + promisify?: Promisify; |
| 31 | + } |
| 32 | + |
| 33 | + interface ProxyFunctions { |
| 34 | + [index: string]: Function; |
| 35 | + } |
| 36 | + |
| 37 | + // *NodeAPI* declares methods & members exported by the node java module. |
| 38 | + interface NodeAPI { |
| 39 | + classpath: string[]; |
| 40 | + asyncOptions: AsyncOptions; |
| 41 | + callMethod(instance: any, className: string, methodName: string, args: any[], callback: Callback<any>): void; |
| 42 | + callMethodSync(instance: any, className: string, methodName: string, ...args: any[]): any; |
| 43 | + callStaticMethodSync(className: string, methodName: string, ...args: any[]): any; |
| 44 | + instanceOf(javaObject: any, className: string): boolean; |
| 45 | + registerClient(before: (cb: Callback<void>) => void, after?: (cb: Callback<void>) => void): void; |
| 46 | + registerClientP(beforeP: () => Promise<void>, afterP?: () => Promise<void>): void; |
| 47 | + ensureJvm(done: Callback<void>): void; |
| 48 | + ensureJvm(): Promise<void>; |
| 49 | + |
| 50 | + newShort(val: number): any; |
| 51 | + newLong(val: number): any; |
| 52 | + newFloat(val: number): any; |
| 53 | + newDouble(val: number): any; |
| 54 | + |
| 55 | + import(className: string): any; |
| 56 | + newInstance(className: string, ...args: any[]): void; |
| 57 | + newInstanceSync(className: string, ...args: any[]): any; |
| 58 | + newInstanceP(className: string, ...args: any[]): Promise<any>; |
| 59 | + newArray<T>(className: string, arg: any[]): any; |
| 60 | + getClassLoader(): any; |
| 61 | + |
| 62 | + newProxy(interfaceName: string, functions: ProxyFunctions): any; |
| 63 | + } |
| 64 | +} |
0 commit comments