本文整理汇总了Java中org.codehaus.jackson.map.JsonMappingException.Reference类的典型用法代码示例。如果您正苦于以下问题:Java Reference类的具体用法?Java Reference怎么用?Java Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Reference类属于org.codehaus.jackson.map.JsonMappingException包,在下文中一共展示了Reference类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapException
import org.codehaus.jackson.map.JsonMappingException.Reference; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Status mapException(JsonMappingException exception) {
LOGGER.error(exception.getMessage(), exception);
List<Reference> references = exception.getPath();
if (references != null) {
String message = new String("Wrong elements: ");
for (Reference reference : references) {
message += reference.getFieldName() + ", ";
}
message = message.substring(0, message.length() - 2);
message += ".";
return new Status("error.rest.badrequest", null, BAD_REQUEST, new Reason(
new StaticLocalizedMessage(message), null, null));
}
return new Status("error.rest.badrequest", null, BAD_REQUEST);
}
示例2: handle
import org.codehaus.jackson.map.JsonMappingException.Reference; //导入依赖的package包/类
/**
* Handle messages of {@link JsonMappingException}
*
* @param exception
* {@link JsonMappingException}
* @param apiResult
* error result
* @return {@link ApiResult} with error messages
*/
@Override
public ApiResult<Object> handle(JsonMappingException exception, ApiResult<Object> apiResult) {
apiResult.setMessage(getErrorMessage(exception));
List<Reference> references = exception.getPath();
List<ApiResultError> apiResultErrors = new ArrayList<ApiResultError>();
if (references != null) {
ApiResultError error = new ApiResultError();
error.setCause("Exception");
String message = new String("wrong elements: ");
for (Reference reference : references) {
message += reference.getFieldName() + ", ";
}
message = message.substring(0, message.length() - 2);
message += ".";
error.setMessage(message);
apiResultErrors.add(error);
}
apiResult.setErrors(apiResultErrors);
return apiResult;
}
示例3: serializeFields
import org.codehaus.jackson.map.JsonMappingException.Reference; //导入依赖的package包/类
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
throws IOException, JsonGenerationException
{
BeanPropertyWriter[] arrayOfBeanPropertyWriter;
if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
arrayOfBeanPropertyWriter = this._filteredProps;
int i;
JsonMappingException localJsonMappingException;
while (true)
{
i = 0;
try
{
int j = arrayOfBeanPropertyWriter.length;
while (true)
if (i < j)
{
BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
if (localBeanPropertyWriter != null)
localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
i++;
continue;
arrayOfBeanPropertyWriter = this._props;
break;
}
if (this._anyGetterWriter != null)
this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
return;
}
catch (Exception localException)
{
if (i == arrayOfBeanPropertyWriter.length);
for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
{
wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
return;
}
}
catch (StackOverflowError localStackOverflowError)
{
localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
if (i != arrayOfBeanPropertyWriter.length);
}
}
for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
{
localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
throw localJsonMappingException;
}
}
示例4: serializeFieldsFiltered
import org.codehaus.jackson.map.JsonMappingException.Reference; //导入依赖的package包/类
protected void serializeFieldsFiltered(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
throws IOException, JsonGenerationException
{
BeanPropertyWriter[] arrayOfBeanPropertyWriter;
if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
arrayOfBeanPropertyWriter = this._filteredProps;
int i;
JsonMappingException localJsonMappingException;
while (true)
{
BeanPropertyFilter localBeanPropertyFilter = findFilter(paramSerializerProvider);
i = 0;
try
{
int j = arrayOfBeanPropertyWriter.length;
while (true)
if (i < j)
{
BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
if (localBeanPropertyWriter != null)
localBeanPropertyFilter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider, localBeanPropertyWriter);
i++;
continue;
arrayOfBeanPropertyWriter = this._props;
break;
}
if (this._anyGetterWriter != null)
this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
return;
}
catch (Exception localException)
{
if (i == arrayOfBeanPropertyWriter.length);
for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
{
wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
return;
}
}
catch (StackOverflowError localStackOverflowError)
{
localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
if (i != arrayOfBeanPropertyWriter.length);
}
}
for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
{
localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
throw localJsonMappingException;
}
}
示例5: serializeFields
import org.codehaus.jackson.map.JsonMappingException.Reference; //导入依赖的package包/类
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
{
BeanPropertyWriter[] arrayOfBeanPropertyWriter;
if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
arrayOfBeanPropertyWriter = this._filteredProps;
int i;
JsonMappingException localJsonMappingException;
while (true)
{
i = 0;
try
{
int j = arrayOfBeanPropertyWriter.length;
while (true)
if (i < j)
{
BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
if (localBeanPropertyWriter != null)
localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
i++;
continue;
arrayOfBeanPropertyWriter = this._props;
break;
}
if (this._anyGetterWriter != null)
this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
return;
}
catch (Exception localException)
{
if (i == arrayOfBeanPropertyWriter.length);
for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
{
wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
return;
}
}
catch (StackOverflowError localStackOverflowError)
{
localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
if (i != arrayOfBeanPropertyWriter.length);
}
}
for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
{
localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
throw localJsonMappingException;
}
}