public final class AdapterHelper extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
adapt(Object target,
Class<T> adapterClass)
Adapt an object to the requested target class if possible
|
static <T> T |
adapt(Object target,
Class<T> adapterClass,
boolean load)
Adapt an object to the requested target class if possible
|
public static <T> T adapt(Object target, Class<T> adapterClass)
The following order is tried:
IAdaptable
IAdapterManager.getAdapter(Object, Class)
target
- the object to convertadapterClass
- the target classnull
if the
object cannot be adapted to the target classpublic static <T> T adapt(Object target, Class<T> adapterClass, boolean load)
The following order is tried:
IAdaptable
IAdapterManager.getAdapter(Object, Class)
if the
parameter
loadis
false
IAdapterManager.loadAdapter(Object, String)
if the
parameter
loadis
true
target
- the object to convertadapterClass
- the target classload
- a flag allowing to control if the adapter manager should also
try loading bundles. See
IAdapterManager.loadAdapter(Object, String)
null
if the
object cannot be adapted to the target class