io.vertx.up.uca.rs.mime.resolver.JsonResolver Maven / Gradle / Ivy
package io.vertx.up.uca.rs.mime.resolver;
import io.vertx.ext.web.RoutingContext;
import io.vertx.up.atom.Epsilon;
import io.vertx.up.exception.WebException;
import io.vertx.up.log.Annal;
import io.vertx.up.runtime.ZeroSerializer;
import io.vertx.up.uca.rs.mime.Resolver;
/**
* Json Resolver
*
* @param
*/
@SuppressWarnings("unchecked")
public class JsonResolver implements Resolver {
private static final Annal LOGGER = Annal.get(JsonResolver.class);
@Override
public Epsilon resolve(final RoutingContext context,
final Epsilon income)
throws WebException {
// Json Resolver
final String content = context.getBodyAsString();
LOGGER.info("[ ZERO ] ( Resolver ) Income Type: {0}", income.getArgType().getName());
final Object result = ZeroSerializer.getValue(income.getArgType(), content);
if (null != result) {
income.setValue((T) result);
}
return income;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy