当前位置: 首页>>代码示例>>Java>>正文


Java Reference类代码示例

本文整理汇总了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);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:20,代码来源:JsonMappingExceptionMapper.java

示例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;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:30,代码来源:JsonMappingExceptionMapper.java

示例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;
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:51,代码来源:BeanSerializer.java

示例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;
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:52,代码来源:BeanSerializer.java

示例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;
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:50,代码来源:BeanSerializerBase.java


注:本文中的org.codehaus.jackson.map.JsonMappingException.Reference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。