public final class ApiSource
extends java.lang.Object
A factory that provides the handle to the API and the way to setup the Remote API. Only one instance of the API exists during the lifetime of a program run; as far as a program is concerned, the API is a singleton and this factory provides the means of getting a reference to it. Classes interested in using the API can declare an object constant via the following code to make the reference available to all methods.
private final API api = ApiSource.getAPI();
For the Remote API, initRemoteAPI
must be invoked prior to any of the calls to
getAPI
.
Modifier and Type | Method and Description |
---|---|
static API |
getAPI()
Provides the handle to the API.
|
static void |
initRemoteAPI(java.lang.String host,
int port)
Initializes the Remote API.
|
public static API getAPI()
API.run()
is called.null
when used remotely
prior to calling initRemoteAPI
.initRemoteAPI(java.lang.String, int)
,
API.run()
public static void initRemoteAPI(java.lang.String host, int port)
getAPI
.
Calling this method informs the factory that it should provide a
remote proxy implementation. However, a socket connection is not
established until API.run()
is called. In between initRemoteAPI()
and run()
, listeners should be added.Copyright © 2017 nintaco.com
Nintaco is free software; you can redistribute it and/or modify it under the terms of LGPLv2.1.