当前位置: 首页>>代码示例>>Java>>正文


Java JsonIgnoreType类代码示例

本文整理汇总了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();
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:26,代码来源:CreatorUtils.java

示例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();
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:31,代码来源:CreatorUtils.java

示例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 );

}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:22,代码来源:PropertyProcessor.java

示例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());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:JacksonAnnotationIntrospector.java

示例5: isTypeIgnored

import com.fasterxml.jackson.annotation.JsonIgnoreType; //导入依赖的package包/类
private static boolean isTypeIgnored(final Class<?> declaringClass) {
    return isAnnotationPresent(declaringClass, JsonIgnoreType.class);
}
 
开发者ID:sdaschner,项目名称:jaxrs-analyzer,代码行数:4,代码来源:JavaTypeAnalyzer.java

示例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();
}
 
开发者ID:yunspace,项目名称:dropwizard-xml,代码行数:5,代码来源:JacksonXMLMessageBodyProvider.java


注:本文中的com.fasterxml.jackson.annotation.JsonIgnoreType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。