![JAR search and dependency download from the Maven repository](/logo.png)
net.savantly.sprout.module.content.model.contentField.ContentFieldKeyDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sprout-modules-content Show documentation
Show all versions of sprout-modules-content Show documentation
Provides dynamic content management for the Sprout Platform
The newest version!
package net.savantly.sprout.module.content.model.contentField;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;
public class ContentFieldKeyDeserializer extends KeyDeserializer {
private ContentFieldRepository repository;
public ContentFieldKeyDeserializer(ContentFieldRepository repository) {
this.repository = repository;
}
@Override
public ContentField deserializeKey(String key, DeserializationContext ctx) throws IOException, JsonProcessingException {
String[] parts = key.split("/");
return repository.findById(parts[parts.length-1]).orElseThrow(RuntimeException::new);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy