Top Description Methods
com.amazon.ion.facet

public Interface Faceted

Known Direct Subinterfaces
com.amazon.ion.IonReader, com.amazon.ion.IonWriter, com.amazon.ion.Span
Known Direct Implementers
com.amazon.ion.impl.DowncastingFaceted

Provides access to optional extension interfaces of a subject instance. Users can request a facet of the subject by passing the desired type token to asFacet(Class). Different implementations, or even different instances, of a subject may support different facets. Consult the subject's documentation to determine which facets are available in each circumstance.

Design Notes

Given a concrete Faceted class, it may be that some instances support a particular facet while others do not, depending on the state of the subject or the way it was constructed. In such cases asFacet should choose whether to return the facet based on the subject's state. Such classes should not extend the facet interface (directly or indirectly), since that allows clients to bypass asFacet and simply downcast the subject to the facet, causing problems for instances that can't support the facet.
See Also
Facets

Method Summary

Modifier and TypeMethod and Description
public <
The requested facet type.
T
>
T

Returns:

An instance of T representing the facet of the subject, or null if the facet is not supported by the subject.
asFacet
(Class<T>
The type token of the requested facet type.
facetType
)

Returns a facet of this subject if supported.

Method Detail

asFacetback to summary
public <T> T asFacet(Class<T> facetType)

Returns a facet of this subject if supported.

Parameters
<T>
The requested facet type.
facetType:Class<T>

The type token of the requested facet type.

Returns:T

An instance of T representing the facet of the subject, or null if the facet is not supported by the subject.

See Also
Facets#asFacet(Class, Faceted), Facets#assumeFacet(Class, Faceted)