Class AWrapper<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      AWrapper​(T wrapped)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      java.lang.String toString()  
      T unwrap()
      Returns the platform-specific object corresponding to this abstraction.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AWrapper

        public AWrapper​(T wrapped)
    • Method Detail

      • unwrap

        public T unwrap()
        Description copied from interface: AAbstraction
        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();
         
         
        Specified by:
        unwrap in interface AAbstraction
        See Also:
        Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object