Spring Data Core

org.springframework.data.convert
Class MappingContextTypeInformationMapper

java.lang.Object
  extended by org.springframework.data.convert.MappingContextTypeInformationMapper
All Implemented Interfaces:
TypeInformationMapper

public class MappingContextTypeInformationMapper
extends Object
implements TypeInformationMapper

TypeInformationMapper implementation that can be either set up using a MappingContext or manually set up Map of String aliases to types. If a MappingContext is used the Map will be build inspecting the PersistentEntity instances for type alias information.

Author:
Oliver Gierke

Constructor Summary
MappingContextTypeInformationMapper(MappingContext<? extends PersistentEntity<?,?>,?> mappingContext)
          Creates a MappingContextTypeInformationMapper from the given MappingContext.
 
Method Summary
 Object createAliasFor(TypeInformation<?> type)
          Returns the alias to be used for the given TypeInformation.
 TypeInformation<?> resolveTypeFrom(Object alias)
          Returns the actual TypeInformation to be used for the given alias.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingContextTypeInformationMapper

public MappingContextTypeInformationMapper(MappingContext<? extends PersistentEntity<?,?>,?> mappingContext)
Creates a MappingContextTypeInformationMapper from the given MappingContext. Inspects all PersistentEntity instances for alias information and builds a Map of aliases to types from it.

Parameters:
mappingContext - must not be null.
Method Detail

createAliasFor

public Object createAliasFor(TypeInformation<?> type)
Description copied from interface: TypeInformationMapper
Returns the alias to be used for the given TypeInformation.

Specified by:
createAliasFor in interface TypeInformationMapper
Returns:

resolveTypeFrom

public TypeInformation<?> resolveTypeFrom(Object alias)
Description copied from interface: TypeInformationMapper
Returns the actual TypeInformation to be used for the given alias.

Specified by:
resolveTypeFrom in interface TypeInformationMapper
Parameters:
alias - can be null.
Returns:

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.