Interface AAbstraction

    • Method Detail

      • unwrap

        <T> T unwrap()
        Returns the platform-specific object corresponding to this abstraction. The generic type parameter is used to avoid casts when assigning to platform-specific objects. It is the obligation of the caller to make sure the right type is used, otherwise a ClassCastException will be thrown.

        Sample usage:

         
         interface ACalendar extends AAbstraction[...]
         class LocalDateAsCalendarWrapper extends AWrapper<LocalDate>[...]
         [...]
         ACalendar calendar = Wrappers.of(LocalDate.now()).as(ACalendar.class);
         [...]
         LocalDate date = calendar.unwrap();
         
         
        Type Parameters:
        T - the type of the platform-specific object
        See Also:
        Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.