@Override public JsonSerializer<?> findMapLikeSerializer(SerializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<Object> elementValueSerializer) { if (Multimap.class.isAssignableFrom(type.getRawClass())) { final AnnotationIntrospector intr = config.getAnnotationIntrospector(); Object filterId = intr.findFilterId((Annotated)beanDesc.getClassInfo()); JsonIgnoreProperties.Value ignorals = config.getDefaultPropertyIgnorals(Multimap.class, beanDesc.getClassInfo()); Set<String> ignored = (ignorals == null) ? null : ignorals.getIgnored(); return new MultimapSerializer(type, beanDesc, keySerializer, elementTypeSerializer, elementValueSerializer, ignored, filterId); } return null; }
@Override // since 2.6 @Deprecated // since 2.8 public String[] findPropertiesToIgnore(Annotated a, boolean forSerialization) { JsonIgnoreProperties.Value v = findPropertyIgnorals(a); if (v == null) { return null; } // 13-May-2015, tatu: As per [databind#95], allow read-only/write-only props if (forSerialization) { if (v.getAllowGetters()) { return null; } } else { if (v.getAllowSetters()) { return null; } } Set<String> ignored = v.getIgnored(); return ignored.toArray(new String[ignored.size()]); }
@Override public JsonSerializer<?> findMapSerializer(SerializationConfig config, MapType type, BeanDescription beanDesc, JsonSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<Object> elementValueSerializer) { // without this logic, Jackson will not be able to handle maps containing // hibernate proxies if (AbstractEntity.class.isAssignableFrom(type.getContentType().getRawClass())) { Object filterId = config.getAnnotationIntrospector().findFilterId((Annotated)beanDesc.getClassInfo()); return MapSerializer.construct( config.getAnnotationIntrospector().findPropertyIgnorals(beanDesc.getClassInfo()).getIgnored(), type, false, elementTypeSerializer, keySerializer, elementValueSerializer, filterId); } else { return null; } }
builder.setIgnoreUnknownProperties(ignoreAny); ignored = ignorals.getIgnored(); for (String propName : ignored) { builder.addIgnorable(propName);