Package com.amazon.ion.facet
Interface Faceted
-
- All Known Subinterfaces:
_Private_IonManagedWriter,_Private_IonRawWriter,_Private_IonWriter,_Private_ListWriter,IonBinaryWriter,IonReader,IonTextReader,IonWriter,Span
- All Known Implementing Classes:
_Private_IonBinaryWriterImpl,_Private_IonWriterBase
public interface FacetedProvides access to optional extension interfaces of a subject instance. Users can request a facet of the subject by passing the desired type token toasFacet(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 concreteFacetedclass, 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 casesasFacetshould 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 bypassasFacetand simply downcast the subject to the facet, causing problems for instances that can't support the facet.- See Also:
Facets
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TasFacet(java.lang.Class<T> facetType)Returns a facet of this subject if supported.
-
-
-
Method Detail
-
asFacet
<T> T asFacet(java.lang.Class<T> facetType)
Returns a facet of this subject if supported.- Type Parameters:
T- The requested facet type.- Parameters:
facetType- The type token of the requested facet type.- Returns:
- 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)
-
-