• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.cfg;
2 
3 import com.fasterxml.jackson.databind.type.LogicalType;
4 
5 /**
6  * Set of possible actions for requested coercion from an
7  * input shape {@link CoercionInputShape}
8  * that does not directly or naturally match target type
9  * ({@link LogicalType}).
10  * This action is suggestion for deserializers to use in cases
11  * where alternate actions could be appropriate: it is up to deserializer
12  * to check configured action and take it into consideration.
13  *
14  * @since 2.12
15  */
16 public enum CoercionAction
17 {
18     /**
19      * Action to fail coercion attempt with exceptipn
20      */
21     Fail,
22 
23     /**
24      * Action to attempt coercion (which may lead to failure)
25      */
26     TryConvert,
27 
28     /**
29      * Action to convert to {@code null} value
30      */
31     AsNull,
32 
33     /**
34      * Action to convert to "empty" value for type, whatever that is: for
35      * primitive types and their wrappers this is "default" value (for example,
36      * for {@code int} that would be {@code 0}); for {@link java.util.Collection}s
37      * empty collection; for POJOs instance configured with default constructor
38      * and so on.
39      */
40     AsEmpty;
41     ;
42 }
43