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

项目: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();
}
项目: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();
}
项目: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 );

}
项目:QuizUpWinner    文件:JacksonAnnotationIntrospector.java   
public Boolean isIgnorableType(AnnotatedClass paramAnnotatedClass)
{
  JsonIgnoreType localJsonIgnoreType = (JsonIgnoreType)paramAnnotatedClass.getAnnotation(JsonIgnoreType.class);
  if (localJsonIgnoreType == null)
    return null;
  return Boolean.valueOf(localJsonIgnoreType.value());
}
项目:jaxrs-analyzer    文件:JavaTypeAnalyzer.java   
private static boolean isTypeIgnored(final Class<?> declaringClass) {
    return isAnnotationPresent(declaringClass, JsonIgnoreType.class);
}
项目:dropwizard-xml    文件:JacksonXMLMessageBodyProvider.java   
private boolean isProvidable(Class<?> type) {
    final JsonIgnoreType ignore = type.getAnnotation(JsonIgnoreType.class);
    return (ignore == null) || !ignore.value();
}