// Type definitions for java 0.9.1 // Project: https://github.com/joeferner/node-java // Definitions by: Jim Lloyd , Kentaro Teramoto , Matthieu Dartiguenave // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// // This is the core API exposed by https://github.com/joeferner/java. // To get the full power of Typescript with Java, see https://github.com/RedSeal-co/ts-java. declare var NodeJavaCore: NodeJavaCore.NodeAPI; export = NodeJavaCore; declare namespace NodeJavaCore { export interface Callback { (err?: Error, result?: T): void; } interface Promisify { (funct: Function, receiver?: any): Function; } interface AsyncOptions { syncSuffix: string; asyncSuffix?: string; promiseSuffix?: string; promisify?: Promisify; } interface ProxyFunctions { [index: string]: Function; } // *NodeAPI* declares methods & members exported by the node java module. interface NodeAPI { classpath: string[]; options: string[]; asyncOptions: AsyncOptions; nativeBindingLocation: string; callMethod(instance: any, methodName: string, args: any[], callback: Callback): void; callMethodSync(instance: any, methodName: string, ...args: any[]): any; callStaticMethod(className: string, methodName: string, ...args: Array>): void; callStaticMethodSync(className: string, methodName: string, ...args: any[]): any; getStaticFieldValue(className: string, fieldName: string): any; setStaticFieldValue(className: string, fieldName: string, newValue: any): void; instanceOf(javaObject: any, className: string): boolean; registerClient(before: (cb: Callback) => void, after?: (cb: Callback) => void): void; registerClientP(beforeP: () => Promise, afterP?: () => Promise): void; ensureJvm(done: Callback): void; ensureJvm(): Promise; isJvmCreated(): boolean; newByte(val: number): any; newChar(val: string|number): any; newDouble(val: number): any; newShort(val: number): any; newLong(val: number): any; newFloat(val: number): any; newDouble(val: number): any; import(className: string): any; newInstance(className: string, ...args: any[]): void; newInstanceSync(className: string, ...args: any[]): any; newInstanceP(className: string, ...args: any[]): Promise; newArray(className: string, arg: any[]): any; getClassLoader(): any; newProxy(interfaceName: string, functions: ProxyFunctions): any; } }