本文整理匯總了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;
}
示例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;
}
示例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;
}