net.mossol.bot.connection.LocationInfoRequestConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of line_bot_mossol-lib Show documentation
Show all versions of line_bot_mossol-lib Show documentation
Line Bot Mossol (line_bot_mossol-lib)
package net.mossol.bot.connection;
import javax.annotation.Nullable;
import net.mossol.bot.model.LocationInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.linecorp.armeria.common.AggregatedHttpMessage;
import com.linecorp.armeria.server.ServiceRequestContext;
import com.linecorp.armeria.server.annotation.RequestConverterFunction;
public class LocationInfoRequestConverter implements RequestConverterFunction {
private static final ObjectMapper objectMapper = new ObjectMapper();
@Nullable
@Override
public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request,
Class> expectedResultType) throws Exception {
if (expectedResultType == LocationInfo.class) {
return objectMapper.readValue(request.contentUtf8(), LocationInfo.class);
}
return RequestConverterFunction.fallthrough();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy