Spring Data Commons

org.springframework.data.repository.support
Class DomainClassConverter

java.lang.Object
  extended by org.springframework.data.repository.support.DomainClassConverter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.core.convert.converter.ConditionalGenericConverter, org.springframework.core.convert.converter.GenericConverter

public class DomainClassConverter
extends java.lang.Object
implements org.springframework.core.convert.converter.ConditionalGenericConverter, org.springframework.context.ApplicationContextAware

Converter to convert arbitrary input into domain classes managed by Spring Data CrudRepository s. The implementation uses a ConversionService in turn to convert the source type into the domain class' id type which is then converted into a domain class object by using a CrudRepository.

Author:
Oliver Gierke

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
org.springframework.core.convert.converter.GenericConverter.ConvertiblePair
 
Constructor Summary
DomainClassConverter(org.springframework.core.convert.ConversionService service)
          Creates a new DomainClassConverter.
 
Method Summary
 java.lang.Object convert(java.lang.Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
           
 java.util.Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()
           
 boolean matches(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
           
 void setApplicationContext(org.springframework.context.ApplicationContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainClassConverter

public DomainClassConverter(org.springframework.core.convert.ConversionService service)
Creates a new DomainClassConverter.

Parameters:
service -
Method Detail

getConvertibleTypes

public java.util.Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()
Specified by:
getConvertibleTypes in interface org.springframework.core.convert.converter.GenericConverter

convert

public java.lang.Object convert(java.lang.Object source,
                                org.springframework.core.convert.TypeDescriptor sourceType,
                                org.springframework.core.convert.TypeDescriptor targetType)
Specified by:
convert in interface org.springframework.core.convert.converter.GenericConverter

matches

public boolean matches(org.springframework.core.convert.TypeDescriptor sourceType,
                       org.springframework.core.convert.TypeDescriptor targetType)
Specified by:
matches in interface org.springframework.core.convert.converter.ConditionalGenericConverter

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext context)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

Spring Data Commons

Copyright © 2012. All Rights Reserved.