Top Description Constructors Methods
com.amazon.ion.facet

public Class Facets

extends Object
Class Inheritance

Utility methods for working with facets.
See Also
Faceted

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> T

Returns:

the requested facet, or null if subject is null or if subject doesn't support the requested facet type.
asFacet
(Class<T> facetType, Faceted subject)

Returns a facet of the given subject if supported, returning null otherwise.

public static <T> T

Returns:

the requested facet, or null if subject is null or if subject doesn't support the requested facet type.
asFacet
(Class<T> facetType, Object subject)

Returns a facet of the given subject if supported, returning null otherwise.

public static <T> T

Returns:

not null.
assumeFacet
(Class<T> facetType, Faceted subject)

Returns a facet of the given subject if supported, throwing an exception otherwise.

public static <T> T

Returns:

not null.
assumeFacet
(Class<T> facetType, Object subject)

Returns a facet of the given subject if supported, throwing an exception otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Facetsback to summary
public Facets()

Method Detail

asFacetback to summary
public static <T> T asFacet(Class<T> facetType, Faceted subject)

Returns a facet of the given subject if supported, returning null otherwise.

This does not attempt to cast the subject to the requested type, since the Faceted interface declares the intent to control the conversion.

Returns:T

the requested facet, or null if subject is null or if subject doesn't support the requested facet type.

asFacetback to summary
public static <T> T asFacet(Class<T> facetType, Object subject)

Returns a facet of the given subject if supported, returning null otherwise.

If the subject implements Faceted, then this conversion is delegated to Faceted#asFacet(Class). Otherwise, a simple cast of the subject is attempted.

Returns:T

the requested facet, or null if subject is null or if subject doesn't support the requested facet type.

assumeFacetback to summary
public static <T> T assumeFacet(Class<T> facetType, Faceted subject)

Returns a facet of the given subject if supported, throwing an exception otherwise.

This does not attempt to cast the subject to the requested type, since the Faceted interface declares the intent to control the conversion.

Returns:T

not null.

Exceptions
UnsupportedFacetException:
if subject is null or if the subject doesn't support the requested facet type.
assumeFacetback to summary
public static <T> T assumeFacet(Class<T> facetType, Object subject)

Returns a facet of the given subject if supported, throwing an exception otherwise.

If the subject implements Faceted, then this conversion is delegated to Faceted#asFacet(Class). Otherwise, a simple cast of the subject is attempted.

Returns:T

not null.

Exceptions
UnsupportedFacetException:
if subject is null or if the subject doesn't support the requested facet type.