public class DefaultTypeMapper<S> extends Object implements TypeMapper<S>
TypeMapper.| Constructor and Description |
|---|
DefaultTypeMapper(TypeAliasAccessor<S> accessor)
Creates a new
DefaultTypeMapper using the given TypeAliasAccessor. |
DefaultTypeMapper(TypeAliasAccessor<S> accessor,
List<? extends TypeInformationMapper> mappers)
|
DefaultTypeMapper(TypeAliasAccessor<S> accessor,
MappingContext<? extends PersistentEntity<?,?>,?> mappingContext,
List<? extends TypeInformationMapper> additionalMappers)
Creates a new
DefaultTypeMapper using the given TypeAliasAccessor, MappingContext and
additional TypeInformationMappers. |
| Modifier and Type | Method and Description |
|---|---|
protected Alias |
getAliasFor(TypeInformation<?> info)
Returns the alias to be used for the given
TypeInformation. |
protected TypeInformation<?> |
getFallbackTypeFor(S source)
Returns the type fallback
TypeInformation in case none could be extracted from the given source. |
TypeInformation<?> |
readType(S source)
Reads the
TypeInformation from the given source. |
<T> TypeInformation<? extends T> |
readType(S source,
TypeInformation<T> basicType)
Returns the
TypeInformation from the given source if it is a more concrete type than the given default one. |
void |
writeType(Class<?> type,
S dbObject)
Writes type information for the given type into the given sink.
|
void |
writeType(TypeInformation<?> info,
S sink)
Writes type information for the given
TypeInformation into the given sink. |
public DefaultTypeMapper(TypeAliasAccessor<S> accessor)
DefaultTypeMapper using the given TypeAliasAccessor. It will use a
SimpleTypeInformationMapper to calculate type aliases.accessor - must not be null.public DefaultTypeMapper(TypeAliasAccessor<S> accessor, List<? extends TypeInformationMapper> mappers)
accessor - must not be null.mappers - must not be null.public DefaultTypeMapper(TypeAliasAccessor<S> accessor, @Nullable MappingContext<? extends PersistentEntity<?,?>,?> mappingContext, List<? extends TypeInformationMapper> additionalMappers)
DefaultTypeMapper using the given TypeAliasAccessor, MappingContext and
additional TypeInformationMappers. Will register a MappingContextTypeInformationMapper before the
given additional mappers.accessor - must not be null.mappingContext - additionalMappers - must not be null.@Nullable public TypeInformation<?> readType(S source)
TypeMapperTypeInformation from the given source.readType in interface TypeMapper<S>source - must not be null.public <T> TypeInformation<? extends T> readType(S source, TypeInformation<T> basicType)
TypeMapperTypeInformation from the given source if it is a more concrete type than the given default one.readType in interface TypeMapper<S>source - must not be null.basicType - must not be null.@Nullable protected TypeInformation<?> getFallbackTypeFor(S source)
TypeInformation in case none could be extracted from the given source.source - will never be null.public void writeType(Class<?> type, S dbObject)
TypeMapperwriteType in interface TypeMapper<S>type - must not be null.dbObject - must not be null.public void writeType(TypeInformation<?> info, S sink)
TypeMapperTypeInformation into the given sink.writeType in interface TypeMapper<S>info - must not be null.sink - must not be null.protected final Alias getAliasFor(TypeInformation<?> info)
TypeInformation.info - must not be nullTypeInformation or null of none was found or all mappers
returned null.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.