io.quarkiverse.unleash.runtime.DefaultUnleashJsonMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-unleash Show documentation
Show all versions of quarkus-unleash Show documentation
Unleash is a feature toggle system
The newest version!
package io.quarkiverse.unleash.runtime;
import java.io.IOException;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkiverse.unleash.UnleashJsonMapper;
import io.quarkus.arc.DefaultBean;
@Singleton
@DefaultBean
public class DefaultUnleashJsonMapper implements UnleashJsonMapper {
@Inject
ObjectMapper objectMapper;
@Override
public T fromJson(String json, Class clazz) {
try {
return objectMapper.readValue(json, clazz);
} catch (IOException e) {
throw new IllegalArgumentException(
"The given string value: " + json + " cannot be transformed to Json object: " + clazz,
e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy