• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.jsontype.impl;
2 
3 import com.fasterxml.jackson.databind.JavaType;
4 import com.fasterxml.jackson.databind.cfg.MapperConfig;
5 import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
6 
7 /**
8  * Default {@link PolymorphicTypeValidator} used unless explicit one is constructed
9  * (and, in 2.11, {@link com.fasterxml.jackson.databind.MapperFeature#BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES}
10  * not enabled).
11  * Does not do any validation, allows all subtypes. Only used for backwards-compatibility
12  * reasons: users should usually NOT use such a permissive implementation but use
13  * allow-list/criteria - based implementation.
14  *
15  * @since 2.10
16  */
17 public final class LaissezFaireSubTypeValidator
18     extends PolymorphicTypeValidator.Base
19 {
20     private static final long serialVersionUID = 1L;
21 
22     public final static LaissezFaireSubTypeValidator instance = new LaissezFaireSubTypeValidator();
23 
24     @Override
validateBaseType(MapperConfig<?> ctxt, JavaType baseType)25     public Validity validateBaseType(MapperConfig<?> ctxt, JavaType baseType) {
26         return Validity.INDETERMINATE;
27     }
28 
29     @Override
validateSubClassName(MapperConfig<?> ctxt, JavaType baseType, String subClassName)30     public Validity validateSubClassName(MapperConfig<?> ctxt,
31             JavaType baseType, String subClassName) {
32         return Validity.ALLOWED;
33     }
34 
35     @Override
validateSubType(MapperConfig<?> ctxt, JavaType baseType, JavaType subType)36     public Validity validateSubType(MapperConfig<?> ctxt, JavaType baseType,
37             JavaType subType) {
38         return Validity.ALLOWED;
39     }
40 }
41