T - the service class type@NonnullByDefault public final class ServiceCallback<T> extends Object implements Terminable
EMPTY| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this resource.
|
boolean |
equals(Object o) |
Optional<T> |
get()
Gets the service provider.
|
T |
getNullable()
Gets the service provider, or null if it is not provided for.
|
int |
hashCode() |
boolean |
isClosed()
Gets if the object represented by this instance is already permanently closed.
|
static <T> ServiceCallback<T> |
of(Class<T> serviceClass)
Create a new ServiceCallback for the given class.
|
void |
refresh()
Refreshes the backing instance of the service
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitbindWith, closeAndReportException, closeSilentlypublic static <T> ServiceCallback<T> of(Class<T> serviceClass)
T - the service class typeserviceClass - the service classpublic void refresh()
@Nullable public T getNullable()
public void close()
Terminableclose in interface AutoCloseableclose in interface Terminablepublic boolean isClosed()
TerminableisClosed in interface TerminableCopyright © 2020. All rights reserved.