Class AWrapper<T>
- java.lang.Object
-
- org.faktorips.devtools.abstraction.AWrapper<T>
-
- All Implemented Interfaces:
AAbstraction
- Direct Known Subclasses:
EclipseJavaElement,EclipseLog,EclipseMarker,EclipseResource,EclipseResourceDelta,EclipseWorkspace,PlainJavaJavaElement,PlainJavaMarker,PlainJavaResource,PlainJavaWorkspace
public abstract class AWrapper<T> extends java.lang.Object implements AAbstraction
A wrapper is a platform-dependent implementation of anabstractionthat can beunwrappedto get access to the platform-specific code.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)inthashCode()java.lang.StringtoString()Tunwrap()Returns the platform-specific object corresponding to this abstraction.
-
-
-
Constructor Detail
-
AWrapper
public AWrapper(T wrapped)
-
-
Method Detail
-
unwrap
public T unwrap()
Description copied from interface:AAbstractionReturns 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 aClassCastExceptionwill 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:
unwrapin interfaceAAbstraction- See Also:
Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-