L
- Legacy classM
- Modern classpublic interface LegacyAdapter<L,M>
LegacyAdapter#getLegacy(M)
or {@link LegacyAdapter#getModern(L) calls, as appropriate.
Delegation is done via mapping instances of legacy classes to instances of modern classes.
This adapter is intended to be used to facilitate delegation between interfaces, which can not themselves contain implementation.
NB: If a package contains extensions or implementations of a Legacy or Modern class, and methods that operate on the extensions (instead of on the base Legacy or Modern class) it can not be made backwards compatible, even with an adapter, and thus we recommend conversion to a fully Modern-based implementation.
Modifier and Type | Method and Description |
---|---|
void |
clear()
Resets any mappings in this adapter.
|
L |
getLegacy(M modern)
Used to retrieve the legacy instance associated with a given
modern instance.
|
M |
getModern(L legacy)
Used to retrieve the modern instance associated with a given
legacy instance.
|
L getLegacy(M modern)
This is the method that should typically be invoked to convert from
Modern to Legacy instances, as opposed to LegacyAdapter#wrapToLegacy(M)
which will
naively always wrap.
modern
- - An instance of the modern class.M getModern(L legacy)
This is the method that should typically be invoked to convert from
Legacy to Modern instances, as opposed to LegacyAdapter#wrapToModern(L)
which will
naively always wrap.
legacy
- - An instance of the legacy class.void clear()
Copyright © 2014 Open Microscopy Environment