com.foreach.across.modules.entity.converters.EntityToStringConverter Maven / Gradle / Ivy
package com.foreach.across.modules.entity.converters;
import com.foreach.across.modules.entity.registry.EntityConfiguration;
import com.foreach.across.modules.entity.registry.EntityModel;
import com.foreach.across.modules.entity.registry.EntityRegistry;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.ConditionalGenericConverter;
import java.io.Serializable;
import java.util.Collections;
import java.util.Set;
/**
* @author niels
* @since 9/02/2015
*/
public class EntityToStringConverter implements ConditionalGenericConverter
{
private final EntityRegistry entityRegistry;
public EntityToStringConverter( EntityRegistry entityRegistry ) {
this.entityRegistry = entityRegistry;
}
@Override
public Set getConvertibleTypes() {
return Collections.singleton( new ConvertiblePair( Object.class, String.class ) );
}
@Override
public Object convert( Object source, TypeDescriptor sourceType, TypeDescriptor targetType ) {
if ( source == null ) {
return null;
}
EntityModel
© 2015 - 2024 Weber Informatics LLC | Privacy Policy