public class Adapters
extends java.lang.Object
IAdaptable,
IAdapterManager| Constructor and Description |
|---|
Adapters() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
adapt(java.lang.Object sourceObject,
java.lang.Class<T> adapter)
If it is possible to adapt the given object to the given type, this
returns the adapter.
|
static <T> T |
adapt(java.lang.Object sourceObject,
java.lang.Class<T> adapter,
boolean allowActivation)
If it is possible to adapt the given object to the given type, this
returns the adapter.
|
static <T> java.util.Optional<T> |
of(java.lang.Object sourceObject,
java.lang.Class<T> adapter)
If it is possible to adapt the given object to the given type, this returns
an optional holding the adapter, in all other cases it returns an empty
optional.
|
public static <T> T adapt(java.lang.Object sourceObject,
java.lang.Class<T> adapter,
boolean allowActivation)
sourceObject if it is an instance of the
adapter type.T - class type to adapt tosourceObject - object to adapt, can be nulladapter - type to adapt toallowActivation - if true, plug-ins may be activated if necessary to provide the requested adapter.
if false, the method will return null if an adapter cannot be provided from activated plug-ins.public static <T> T adapt(java.lang.Object sourceObject,
java.lang.Class<T> adapter)
Convenience method for calling adapt(Object, Class, true).
T - class type to adapt tosourceObject - object to adapt, can be nulladapter - type to adapt topublic static <T> java.util.Optional<T> of(java.lang.Object sourceObject,
java.lang.Class<T> adapter)
T - type to adapt tosourceObject - object to adapt, if null then
Optional.empty() is returnedadapter - type to adapt to, must not be null