本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonIgnoreType类的典型用法代码示例。如果您正苦于以下问题:Java JsonIgnoreType类的具体用法?Java JsonIgnoreType怎么用?Java JsonIgnoreType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonIgnoreType类属于com.fasterxml.jackson.annotation包,在下文中一共展示了JsonIgnoreType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterSubtypesForSerialization
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
/**
* <p>filterSubtypesForSerialization</p>
*
* @param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
* @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object.
* @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableList} object.
*/
public static ImmutableList<JClassType> filterSubtypesForSerialization( TreeLogger logger, RebindConfiguration configuration,
JClassType type ) {
boolean filterOnlySupportedType = isObjectOrSerializable( type );
ImmutableList.Builder<JClassType> builder = ImmutableList.builder();
if ( type.getSubtypes().length > 0 ) {
for ( JClassType subtype : type.getSubtypes() ) {
if ( null == subtype.isAnnotation()
&& subtype.isPublic()
&& (!filterOnlySupportedType || configuration.isTypeSupportedForSerialization( logger, subtype ))
&& !findFirstEncounteredAnnotationsOnAllHierarchy( configuration, subtype.isClassOrInterface(), JsonIgnoreType.class, Optional.of( type ) ).isPresent()) {
builder.add( subtype );
}
}
}
return builder.build();
}
示例2: filterSubtypesForDeserialization
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
/**
* <p>filterSubtypesForDeserialization</p>
*
* @param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
* @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object.
* @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
* @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableList} object.
*/
public static ImmutableList<JClassType> filterSubtypesForDeserialization( TreeLogger logger, RebindConfiguration configuration,
JClassType type ) {
boolean filterOnlySupportedType = isObjectOrSerializable( type );
ImmutableList.Builder<JClassType> builder = ImmutableList.builder();
if ( type.getSubtypes().length > 0 ) {
for ( JClassType subtype : type.getSubtypes() ) {
if ( (null == subtype.isInterface() && !subtype.isAbstract() && (!subtype.isMemberType() || subtype.isStatic()))
&& null == subtype.isAnnotation()
&& subtype.isPublic()
&& (!filterOnlySupportedType ||
(configuration.isTypeSupportedForDeserialization( logger, subtype )
// EnumSet and EnumMap are not supported in subtype deserialization because we can't know the enum to use.
&& !EnumSet.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )
&& !EnumMap.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )))
&& !findFirstEncounteredAnnotationsOnAllHierarchy( configuration, subtype.isClassOrInterface(), JsonIgnoreType.class, Optional.of( type ) ).isPresent() ) {
builder.add( subtype );
}
}
}
return builder.build();
}
示例3: isPropertyIgnored
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
private static boolean isPropertyIgnored( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo beanInfo,
JType type, String propertyName ) {
// we first check if the property is ignored
Optional<JsonIgnore> jsonIgnore = propertyAccessors.getAnnotation( JsonIgnore.class );
if ( jsonIgnore.isPresent() && jsonIgnore.get().value() ) {
return true;
}
// if type is ignored, we ignore the property
if ( null != type.isClassOrInterface() ) {
Optional<JsonIgnoreType> jsonIgnoreType = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type
.isClassOrInterface(), JsonIgnoreType.class );
if ( jsonIgnoreType.isPresent() && jsonIgnoreType.get().value() ) {
return true;
}
}
// we check if it's not in the ignored properties
return beanInfo.getIgnoredFields().contains( propertyName );
}
示例4: isIgnorableType
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
public Boolean isIgnorableType(AnnotatedClass paramAnnotatedClass)
{
JsonIgnoreType localJsonIgnoreType = (JsonIgnoreType)paramAnnotatedClass.getAnnotation(JsonIgnoreType.class);
if (localJsonIgnoreType == null)
return null;
return Boolean.valueOf(localJsonIgnoreType.value());
}
示例5: isTypeIgnored
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
private static boolean isTypeIgnored(final Class<?> declaringClass) {
return isAnnotationPresent(declaringClass, JsonIgnoreType.class);
}
示例6: isProvidable
import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
private boolean isProvidable(Class<?> type) {
final JsonIgnoreType ignore = type.getAnnotation(JsonIgnoreType.class);
return (ignore == null) || !ignore.value();
}