本文整理汇总了Java中com.fasterxml.jackson.core.JsonLocation.getColumnNr方法的典型用法代码示例。如果您正苦于以下问题:Java JsonLocation.getColumnNr方法的具体用法?Java JsonLocation.getColumnNr怎么用?Java JsonLocation.getColumnNr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonLocation
的用法示例。
在下文中一共展示了JsonLocation.getColumnNr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTokenLocation
import com.fasterxml.jackson.core.JsonLocation; //导入方法依赖的package包/类
@Override
public XContentLocation getTokenLocation() {
JsonLocation loc = parser.getTokenLocation();
if (loc == null) {
return null;
}
return new XContentLocation(loc.getLineNr(), loc.getColumnNr());
}
示例2: initializeJsonLocation
import com.fasterxml.jackson.core.JsonLocation; //导入方法依赖的package包/类
private void initializeJsonLocation(@Nullable JsonLocation jsonLoc) {
if (jsonLoc == null) {
return;
}
this.charOffset = ((int) jsonLoc.getCharOffset());
this.colNum = jsonLoc.getColumnNr();
this.lineNum = jsonLoc.getLineNr();
}
示例3: createLocation
import com.fasterxml.jackson.core.JsonLocation; //导入方法依赖的package包/类
private Location createLocation(JsonLocation json) {
return new Location(json.getLineNr() - 1, json.getColumnNr() - 1);
}
示例4: toResponse
import com.fasterxml.jackson.core.JsonLocation; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Response toResponse(JsonProcessingException exception) {
Throwable throwable = exception;
while (throwable != null) {
if (throwable instanceof PersistenceException) {
return exceptionMappers.get().findMapping(throwable).toResponse(throwable);
}
throwable = throwable.getCause();
}
logger.debug("Json Processing error", exception);
String message = exception.getOriginalMessage();
String desc = null;
String source = null;
if (mode.isDev()) {
desc = IOUtils.getStackTrace(exception);
JsonLocation location = exception.getLocation();
if (location != null) {
source = "line: " + location.getLineNr() +
", column: " + location.getColumnNr();
} else {
source = exception.getStackTrace()[0].toString();
}
}
ErrorMessage errorMessage = ErrorMessage.fromStatus(Response.Status.BAD_REQUEST.getStatusCode());
errorMessage.setThrowable(exception);
errorMessage.setCode(Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString());
errorMessage.addError(new Result.Error(
errorMessage.getCode(),
message != null ? message : exception.getMessage(),
desc,
source
));
return Response.status(errorMessage.getStatus())
.entity(errorMessage)
.type(ExceptionMapperUtils.getResponseType())
.build();
}