Obtain an object extension that is required. If the object is an instance of the designated class or interface, it
is returned. Otherwise, if the object supports the Extensible interface, that service is used to locate
the requested extension.
Static Methods
Modifier and Type
Static Method and Description
getExtension
static <T> T getExtension(Object o,
Class<T> c)
Obtain an object extension, if supported.
public static <T> T getExtension(Object o,
Class<T> c)
Obtain an object extension, if supported. If the object is an instance of the designated class or interface, it
is returned. Otherwise, if the object supports the Extensible interface, that service is used to locate
the requested extension.
Parameters:
o - The object.
c - The class or interface that designates the extension.
Returns:
the extension, if supported, or null.
getRequiredExtension
static <T> T getRequiredExtension(Object o,
Class<T> c)
public static <T> T getRequiredExtension(Object o,
Class<T> c)
supports
static boolean supports(Object o,
Class<?> c)
Determine whether an object supports the specified extension.
public static boolean supports(Object o,
Class<?> c)
Determine whether an object supports the specified extension.
Parameters:
o - The object.
c - The class or interface that designates the extension.
Returns:
true if o supports the extension designated by c, otherwise false.
supportsAny
static boolean supportsAny(Object o,
Class<?>... cs)
Determine whether an object supports any of a specified set of extensions.
public static boolean supportsAny(Object o,
Class<?>... cs)
Determine whether an object supports any of a specified set of extensions.
Parameters:
o - The object.
cs - The classes or interfaces that designate the extensions.
Returns:
true if o supports any of the extensions designated by cs, otherwise false.