Package com.amazon.ion.facet
Class Facets
- java.lang.Object
-
- com.amazon.ion.facet.Facets
-
public class Facets extends java.lang.ObjectUtility methods for working with facets.- See Also:
Faceted
-
-
Constructor Summary
Constructors Constructor Description Facets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TasFacet(java.lang.Class<T> facetType, Faceted subject)Returns a facet of the given subject if supported, returning null otherwise.static <T> TasFacet(java.lang.Class<T> facetType, java.lang.Object subject)Returns a facet of the given subject if supported, returning null otherwise.static <T> TassumeFacet(java.lang.Class<T> facetType, Faceted subject)Returns a facet of the given subject if supported, throwing an exception otherwise.static <T> TassumeFacet(java.lang.Class<T> facetType, java.lang.Object subject)Returns a facet of the given subject if supported, throwing an exception otherwise.
-
-
-
Method Detail
-
asFacet
public static <T> T asFacet(java.lang.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
Facetedinterface declares the intent to control the conversion.- Returns:
- the requested facet, or null if
subjectis null or if subject doesn't support the requested facet type.
-
asFacet
public static <T> T asFacet(java.lang.Class<T> facetType, java.lang.Object subject)Returns a facet of the given subject if supported, returning null otherwise.If the subject implements
Faceted, then this conversion is delegated toFaceted.asFacet(Class). Otherwise, a simple cast of the subject is attempted.- Returns:
- the requested facet, or null if
subjectis null or if subject doesn't support the requested facet type.
-
assumeFacet
public static <T> T assumeFacet(java.lang.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
Facetedinterface declares the intent to control the conversion.- Returns:
- not null.
- Throws:
UnsupportedFacetException- ifsubjectis null or if the subject doesn't support the requested facet type.
-
assumeFacet
public static <T> T assumeFacet(java.lang.Class<T> facetType, java.lang.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 toFaceted.asFacet(Class). Otherwise, a simple cast of the subject is attempted.- Returns:
- not null.
- Throws:
UnsupportedFacetException- ifsubjectis null or if the subject doesn't support the requested facet type.
-
-