com.fasterxml.jackson.annotation.JsonIgnoreType Java Examples
The following examples show how to use
com.fasterxml.jackson.annotation.JsonIgnoreType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreatorUtils.java From gwt-jackson with Apache License 2.0 | 6 votes |
/** * <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(); }
Example #2
Source File: CreatorUtils.java From gwt-jackson with Apache License 2.0 | 6 votes |
/** * <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(); }
Example #3
Source File: PropertyProcessor.java From gwt-jackson with Apache License 2.0 | 6 votes |
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 ); }
Example #4
Source File: JavaTypeAnalyzer.java From jaxrs-analyzer with Apache License 2.0 | 4 votes |
private static boolean isTypeIgnored(final Class<?> declaringClass) { return isAnnotationPresent(declaringClass, JsonIgnoreType.class); }
Example #5
Source File: JacksonXMLMessageBodyProvider.java From dropwizard-xml with Apache License 2.0 | 4 votes |
private boolean isProvidable(Class<?> type) { final JsonIgnoreType ignore = type.getAnnotation(JsonIgnoreType.class); return (ignore == null) || !ignore.value(); }