Spring Data Commons

org.springframework.data.convert
Class SimpleTypeInformationMapper

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

public class SimpleTypeInformationMapper
extends Object
implements TypeInformationMapper

Basic TypeInformationMapper implementation that interprets the alias handles as fully qualified class name and tries to load a class with the given name to build TypeInformation. Returns the fully qualified class name for alias creation.

Author:
Oliver Gierke

Field Summary
static SimpleTypeInformationMapper INSTANCE
           
 
Constructor Summary
SimpleTypeInformationMapper()
           
 
Method Summary
 String createAliasFor(TypeInformation<?> type)
          Turn the given type information into the String representation that shall be stored.
 TypeInformation<?> resolveTypeFrom(Object source)
          Returns the TypeInformation that shall be used when the given String value is found as type hint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SimpleTypeInformationMapper INSTANCE
Constructor Detail

SimpleTypeInformationMapper

public SimpleTypeInformationMapper()
Method Detail

resolveTypeFrom

public TypeInformation<?> resolveTypeFrom(Object source)
Returns the TypeInformation that shall be used when the given String value is found as type hint. The implementation will simply interpret the given value as fully-qualified class name and try to load the class. Will return null in case the given String is empty.

Specified by:
resolveTypeFrom in interface TypeInformationMapper
Parameters:
value - the type to load, must not be null.
Returns:
the type to be used for the given String representation or null if nothing found or the class cannot be loaded.

createAliasFor

public String createAliasFor(TypeInformation<?> type)
Turn the given type information into the String representation that shall be stored. Default implementation simply returns the fully-qualified class name.

Specified by:
createAliasFor in interface TypeInformationMapper
Parameters:
typeInformation - must not be null.
Returns:
the String representation to be stored or null if no type information shall be stored.

Spring Data Commons

Copyright © 2012. All Rights Reserved.