當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationIntrospector.findSerializationContentType方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.databind.AnnotationIntrospector.findSerializationContentType方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationIntrospector.findSerializationContentType方法的具體用法?Java AnnotationIntrospector.findSerializationContentType怎麽用?Java AnnotationIntrospector.findSerializationContentType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.databind.AnnotationIntrospector的用法示例。


在下文中一共展示了AnnotationIntrospector.findSerializationContentType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hasContentTypeAnnotation

import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入方法依賴的package包/類
public boolean hasContentTypeAnnotation(SerializerProvider paramSerializerProvider, BeanProperty paramBeanProperty)
{
  if (paramBeanProperty != null)
  {
    AnnotationIntrospector localAnnotationIntrospector = paramSerializerProvider.getAnnotationIntrospector();
    if ((localAnnotationIntrospector != null) && (localAnnotationIntrospector.findSerializationContentType(paramBeanProperty.getMember(), paramBeanProperty.getType()) != null))
      return true;
  }
  return false;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:11,代碼來源:ContainerSerializer.java

示例2: modifySecondaryTypesByAnnotation

import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入方法依賴的package包/類
protected static <T extends JavaType> T modifySecondaryTypesByAnnotation(SerializationConfig paramSerializationConfig, Annotated paramAnnotated, T paramT)
{
  AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
  if (paramT.isContainerType())
  {
    Class localClass1 = localAnnotationIntrospector.findSerializationKeyType(paramAnnotated, paramT.getKeyType());
    if (localClass1 != null)
    {
      if (!(paramT instanceof MapType))
        throw new IllegalArgumentException("Illegal key-type annotation: type " + paramT + " is not a Map type");
      try
      {
        paramT = ((MapType)paramT).widenKey(localClass1);
      }
      catch (IllegalArgumentException localIllegalArgumentException2)
      {
        throw new IllegalArgumentException("Failed to narrow key type " + paramT + " with key-type annotation (" + localClass1.getName() + "): " + localIllegalArgumentException2.getMessage());
      }
    }
    Class localClass2 = localAnnotationIntrospector.findSerializationContentType(paramAnnotated, paramT.getContentType());
    if (localClass2 != null)
      try
      {
        JavaType localJavaType = paramT.widenContentsBy(localClass2);
        return localJavaType;
      }
      catch (IllegalArgumentException localIllegalArgumentException1)
      {
        throw new IllegalArgumentException("Failed to narrow content type " + paramT + " with content-type annotation (" + localClass2.getName() + "): " + localIllegalArgumentException1.getMessage());
      }
  }
  return paramT;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:34,代碼來源:BasicSerializerFactory.java

示例3: hasContentTypeAnnotation

import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入方法依賴的package包/類
/**
 * Helper method used to encapsulate logic for determining whether there is
 * a property annotation that overrides element type; if so, we can
 * and need to statically find the serializer.
 * 
 * @since 2.1
 */
protected boolean hasContentTypeAnnotation(SerializerProvider provider,
        BeanProperty property)
{
    if (property != null) {
        AnnotationIntrospector intr = provider.getAnnotationIntrospector();
        if (intr != null) {
            if (intr.findSerializationContentType(property.getMember(), property.getType()) != null) {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:21,代碼來源:ContainerSerializer.java


注:本文中的com.fasterxml.jackson.databind.AnnotationIntrospector.findSerializationContentType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。