當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。