List of usage examples for org.springframework.core.serializer Deserializer deserialize
T deserialize(InputStream inputStream) throws IOException;
From source file:org.springdata.ehcache.convert.EhcacheMappingConverter.java
@Override public <R> R read(Class<R> clazz, ByteArray source) { if (source.isEmpty()) { return null; }/* w w w . java 2 s . c o m*/ Class<R> beanClassLoaderClass = transformClassToBeanClassLoaderClass(clazz); EhcachePersistentEntity<R> entity = (EhcachePersistentEntity<R>) mappingContext .getPersistentEntity(beanClassLoaderClass); if (entity == null) { throw new MappingException("No mapping metadata found for " + source.getClass()); } Deserializer<R> deserializer = entity.getDeserializer(); try { R newInstance = deserializer.deserialize(source.asStream()); return newInstance; } catch (IOException e) { throw new MappingException("deserialization fail for " + beanClassLoaderClass, e); } }