/** * Customized {@link TypeResolverBuilder} that provides type resolver builders * used with so-called "default typing" * (see {@link ObjectMapper#enableDefaultTyping()} for details). *<p> * Type resolver construction is based on configuration: implementation takes care * of only providing builders in cases where type information should be applied. * This is important since build calls may be sent for any and all types, and * type information should NOT be applied to all of them. */ public static class DefaultTypeResolverBuilder extends StdTypeResolverBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Definition of what types is this default typer valid for. */ protected final DefaultTyping _appliesFor; public DefaultTypeResolverBuilder(DefaultTyping t) { _appliesFor = t; } @Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes) : null;
/** * @return {@code com.fasterxml.jackson.databind.ObjectReader} to deserialize {@link BufferedBulkResult} */ protected ObjectReader configuredReader() { return new ObjectMapper() .setVisibility(VisibilityChecker.Std.defaultInstance().with(JsonAutoDetect.Visibility.ANY)) .setSerializationInclusion(JsonInclude.Include.NON_EMPTY) .configure(SerializationFeature.CLOSE_CLOSEABLE, false) .configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true) .addMixIn(BufferedBulkResult.class, BufferedBulkResultMixIn.class) .addMixIn(BulkError.class, BulkErrorMixIn.class) .addMixIn(BulkResultItem.class, BulkResultItemMixIn.class) .readerFor(BufferedBulkResult.class); }
public static void configureObjectMapper(ObjectMapper objectMapper) { objectMapper.addMixIn(Repository.class, RepositoryMixIn.class); objectMapper.addMixIn(RepositorySettings.class, RepositorySettingsMixIn.class); objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.setVisibilityChecker(defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY)); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(SerializationFeature.FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS, false); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); }
/** * Customized {@link TypeResolverBuilder} that provides type resolver builders * used with so-called "default typing" * (see {@link ObjectMapper#enableDefaultTyping()} for details). *<p> * Type resolver construction is based on configuration: implementation takes care * of only providing builders in cases where type information should be applied. * This is important since build calls may be sent for any and all types, and * type information should NOT be applied to all of them. */ public static class DefaultTypeResolverBuilder extends StdTypeResolverBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Definition of what types is this default typer valid for. */ protected final DefaultTyping _appliesFor; public DefaultTypeResolverBuilder(DefaultTyping t) { _appliesFor = t; } @Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes) : null;
/** * Customized {@link TypeResolverBuilder} that provides type resolver builders * used with so-called "default typing" * (see {@link ObjectMapper#enableDefaultTyping()} for details). *<p> * Type resolver construction is based on configuration: implementation takes care * of only providing builders in cases where type information should be applied. * This is important since build calls may be sent for any and all types, and * type information should NOT be applied to all of them. */ public static class DefaultTypeResolverBuilder extends StdTypeResolverBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Definition of what types is this default typer valid for. */ protected final DefaultTyping _appliesFor; public DefaultTypeResolverBuilder(DefaultTyping t) { _appliesFor = t; } @Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes) : null;
/** * Customized {@link TypeResolverBuilder} that provides type resolver builders * used with so-called "default typing" * (see {@link ObjectMapper#enableDefaultTyping()} for details). *<p> * Type resolver construction is based on configuration: implementation takes care * of only providing builders in cases where type information should be applied. * This is important since build calls may be sent for any and all types, and * type information should NOT be applied to all of them. */ public static class DefaultTypeResolverBuilder extends StdTypeResolverBuilder { /** * Definition of what types is this default typer valid for. */ protected final DefaultTyping _appliesFor; public DefaultTypeResolverBuilder(DefaultTyping t) { _appliesFor = t; } @Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes) : null; } @Override
/** * Customized {@link TypeResolverBuilder} that provides type resolver builders * used with so-called "default typing" * (see {@link ObjectMapper#enableDefaultTyping()} for details). *<p> * Type resolver construction is based on configuration: implementation takes care * of only providing builders in cases where type information should be applied. * This is important since build calls may be sent for any and all types, and * type information should NOT be applied to all of them. */ public static class DefaultTypeResolverBuilder extends StdTypeResolverBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Definition of what types is this default typer valid for. */ protected final DefaultTyping _appliesFor; public DefaultTypeResolverBuilder(DefaultTyping t) { _appliesFor = t; } @Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes) : null;
@Override public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: default: // break; return this; } }
@Override public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: default: // break; return this; } }
@Override public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: default: // break; return this; } }
@Override public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: default: // break; return this; } }
public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: // break; } return this; }
public Std withVisibility(PropertyAccessor method, Visibility v) { switch (method) { case GETTER: return withGetterVisibility(v); case SETTER: return withSetterVisibility(v); case CREATOR: return withCreatorVisibility(v); case FIELD: return withFieldVisibility(v); case IS_GETTER: return withIsGetterVisibility(v); case ALL: return with(v); //case NONE: // break; } return this; }
public boolean isFieldVisible(AnnotatedField f) { return isFieldVisible(f.getAnnotated()); }
public boolean isFieldVisible(AnnotatedField f) { return isFieldVisible(f.getAnnotated()); }
public boolean isGetterVisible(AnnotatedMethod m) { return isGetterVisible(m.getAnnotated()); }
public boolean isCreatorVisible(AnnotatedMember m) { return isCreatorVisible(m.getMember()); }
public boolean isSetterVisible(AnnotatedMethod m) { return isSetterVisible(m.getAnnotated()); }
public boolean isIsGetterVisible(AnnotatedMethod m) { return isIsGetterVisible(m.getAnnotated()); }
public boolean isCreatorVisible(AnnotatedMember m) { return isCreatorVisible(m.getMember()); }