Interface AAbstraction
-
- All Known Subinterfaces:
AContainer,AFile,AFolder,AJavaElement,AJavaProject,ALog,AMarker,APackageFragmentRoot,AProject,AResource,AResourceDelta,AWorkspace,AWorkspaceRoot
- All Known Implementing Classes:
AWrapper,EclipseContainer,EclipseFile,EclipseFolder,EclipseJavaElement,EclipseJavaProject,EclipseLog,EclipseMarker,EclipsePackageFragmentRoot,EclipseProject,EclipseResource,EclipseResourceDelta,EclipseWorkspace,EclipseWorkspaceRoot,PlainJavaContainer,PlainJavaFile,PlainJavaFolder,PlainJavaJavaElement,PlainJavaJavaProject,PlainJavaMarker,PlainJavaPackageFragmentRoot,PlainJavaProject,PlainJavaResource,PlainJavaWorkspace,PlainJavaWorkspaceRoot
public interface AAbstractionAn abstraction is a platform-independent concept. It offers access to a platform-dependent implementation via theunwrap()method to allow platform-dependent code to be called with the abstraction but use its own implementation where necessary.- Implementation Requirements:
- There should be an implementation of every abstraction for every platform, extending
AWrapperto wrap the platform-specific objects corresponding to that abstraction.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tunwrap()Returns the platform-specific object corresponding to this abstraction.
-
-
-
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 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();- Type Parameters:
T- the type of the platform-specific object- See Also:
Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
-
-