public class SynonymTypesProvider
extends java.lang.Object
SynonymTypesProvider
allows to define automatic conversion rules
for specific types.
By default, iterables
are compatible to arrays, arrays are compatible to List
,
and boxing / unboxing semantics are applied.
Clients who specialize this service, should announce synonym types by means of
announceSynonym(LightweightTypeReference, ConformanceHint, Acceptor)
,
announceSynonym(LightweightTypeReference, EnumSet, Acceptor)
or
announceSynonym(LightweightTypeReference, int, Acceptor)
.
collectCustomSynonymTypes(LightweightTypeReference, Acceptor)
should be implemented
to announce custom synonyms. Implementations should respect the acceptor return values.ArrayTypes
Modifier and Type | Class and Description |
---|---|
static class |
SynonymTypesProvider.Acceptor
Clients of the
SynonymTypesProvider may use a custom acceptor
to handle the available synonym types. |
Constructor and Description |
---|
SynonymTypesProvider() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addArrayAndListSynonyms(LightweightTypeReference type,
SynonymTypesProvider.Acceptor acceptor) |
protected boolean |
announceSynonym(LightweightTypeReference synonym,
ConformanceHint hint,
SynonymTypesProvider.Acceptor acceptor)
Announce a synonym type with the given conformance hint.
|
protected boolean |
announceSynonym(LightweightTypeReference synonym,
java.util.EnumSet<ConformanceHint> hints,
SynonymTypesProvider.Acceptor acceptor)
Announce a synonym type with the given conformance hints.
|
protected boolean |
announceSynonym(LightweightTypeReference synonym,
int flags,
SynonymTypesProvider.Acceptor acceptor)
Announce a synonym type with the given conformance flags.
|
protected boolean |
collectCustomSynonymTypes(LightweightTypeReference type,
SynonymTypesProvider.Acceptor acceptor)
This is the hook to announce more synonym types.
|
void |
collectSynonymTypes(LightweightTypeReference type,
SynonymTypesProvider.Acceptor acceptor) |
public void collectSynonymTypes(LightweightTypeReference type, SynonymTypesProvider.Acceptor acceptor)
protected boolean collectCustomSynonymTypes(LightweightTypeReference type, SynonymTypesProvider.Acceptor acceptor)
type
- the original typeacceptor
- the acceptor to announce the synonymsprotected boolean addArrayAndListSynonyms(LightweightTypeReference type, SynonymTypesProvider.Acceptor acceptor)
type
- never a primitive or a wrapper typeprotected final boolean announceSynonym(LightweightTypeReference synonym, ConformanceHint hint, SynonymTypesProvider.Acceptor acceptor)
protected final boolean announceSynonym(LightweightTypeReference synonym, java.util.EnumSet<ConformanceHint> hints, SynonymTypesProvider.Acceptor acceptor)
protected final boolean announceSynonym(LightweightTypeReference synonym, int flags, SynonymTypesProvider.Acceptor acceptor)
ConformanceFlags