Interface CloseableShapeshifter

  • All Superinterfaces:
    AutoCloseable, Closeable
    All Known Implementing Classes:
    QueryableIndexRowsAndColumns

    public interface CloseableShapeshifter
    extends Closeable
    A CloseableShapeshifter is an interface created to allow Segments to be used from as(Class), but also to be able to ensure that any resource used by the object returned from the as(Class) method have proper management of their lifecycle. This was initially introduced in order to make it possible for Segment to become a RowsAndColumns without needing to add extra close() methods to RowsAndColumns.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T as​(Class<T> clazz)
      Asks the Object to return itself as a concrete implementation of a specific interface.
    • Method Detail

      • as

        @Nullable
        <T> T as​(@Nonnull
                 Class<T> clazz)
        Asks the Object to return itself as a concrete implementation of a specific interface. The interface asked for will tend to be a semantically-meaningful interface.
        Type Parameters:
        T - The interface that the calling code wants a concrete implementation of
        Parameters:
        clazz - A class object representing the interface that the calling code wants a concrete implementation of
        Returns:
        A concrete implementation of the interface, or null if there is no meaningful optimization to be had through a local implementation of the interface.