
com.nhl.link.rest.parser.converter.LongConverter Maven / Gradle / Ivy
package com.nhl.link.rest.parser.converter;
import javax.ws.rs.core.Response.Status;
import com.fasterxml.jackson.databind.JsonNode;
import com.nhl.link.rest.LinkRestException;
/**
* @since 1.10
*/
public class LongConverter extends AbstractConverter {
private static final LongConverter instance = new LongConverter();
public static LongConverter converter() {
return instance;
}
@Override
protected Long valueNonNull(JsonNode node) {
if (!node.isNumber()) {
throw new LinkRestException(Status.BAD_REQUEST, "Expected 'long' value, got: " + node.asText());
}
return node.asLong();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy