Constructor and Description |
---|
Facets() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
asFacet(Class<T> facetType,
Faceted subject)
Returns a facet of the given subject if supported, returning null
otherwise.
|
static <T> T |
asFacet(Class<T> facetType,
Object subject)
Returns a facet of the given subject if supported, returning null
otherwise.
|
static <T> T |
assumeFacet(Class<T> facetType,
Faceted subject)
Returns a facet of the given subject if supported, throwing an
exception otherwise.
|
static <T> T |
assumeFacet(Class<T> facetType,
Object subject)
Returns a facet of the given subject if supported, throwing an
exception otherwise.
|
public static <T> T asFacet(Class<T> facetType, Faceted subject)
This does not attempt to cast the subject to the requested type, since
the Faceted
interface declares the intent to control the
conversion.
subject
is null or if
subject doesn't support the requested facet type.public static <T> T asFacet(Class<T> facetType, Object subject)
If the subject implements Faceted
, then this conversion is
delegated to Faceted.asFacet(Class)
. Otherwise, a simple
cast of the subject is attempted.
subject
is null or if
subject doesn't support the requested facet type.public static <T> T assumeFacet(Class<T> facetType, Faceted subject)
This does not attempt to cast the subject to the requested type, since
the Faceted
interface declares the intent to control the
conversion.
UnsupportedFacetException
- if subject
is null or if the
subject doesn't support the requested facet type.public static <T> T assumeFacet(Class<T> facetType, Object subject)
If the subject implements Faceted
, then this conversion is
delegated to Faceted.asFacet(Class)
. Otherwise, a simple
cast of the subject is attempted.
UnsupportedFacetException
- if subject
is null or if the
subject doesn't support the requested facet type.