Package com.amazon.ion.facet
Class Facets
java.lang.Object
com.amazon.ion.facet.Facets
Utility methods for working with facets.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TReturns a facet of the given subject if supported, returning null otherwise.static <T> TReturns a facet of the given subject if supported, returning null otherwise.static <T> TassumeFacet(Class<T> facetType, Faceted subject) Returns a facet of the given subject if supported, throwing an exception otherwise.static <T> TassumeFacet(Class<T> facetType, Object subject) Returns a facet of the given subject if supported, throwing an exception otherwise.
-
Constructor Details
-
Facets
public Facets()
-
-
Method Details
-
asFacet
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
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
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
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.
-