类com.fasterxml.jackson.annotation.JsonIgnoreType源码实例Demo

下面列出了怎么用com.fasterxml.jackson.annotation.JsonIgnoreType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: gwt-jackson   文件: CreatorUtils.java
/**
 * <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 项目: gwt-jackson   文件: CreatorUtils.java
/**
 * <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 项目: gwt-jackson   文件: PropertyProcessor.java
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 项目: jaxrs-analyzer   文件: JavaTypeAnalyzer.java
private static boolean isTypeIgnored(final Class<?> declaringClass) {
    return isAnnotationPresent(declaringClass, JsonIgnoreType.class);
}
 
private boolean isProvidable(Class<?> type) {
    final JsonIgnoreType ignore = type.getAnnotation(JsonIgnoreType.class);
    return (ignore == null) || !ignore.value();
}
 
 类方法
 同包方法