• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.cfg;
2 
3 import java.util.Arrays;
4 
5 /**
6  * @since 2.12
7  */
8 public class CoercionConfig
9     implements java.io.Serializable
10 {
11     private static final long serialVersionUID = 1L;
12 
13     private final static int INPUT_SHAPE_COUNT = CoercionInputShape.values().length;
14 
15     protected Boolean _acceptBlankAsEmpty;
16 
17     /**
18      * Mapping from {@link CoercionInputShape} into corresponding
19      * {@link CoercionAction}.
20      */
21     protected final CoercionAction[] _coercionsByShape;
22 
CoercionConfig()23     public CoercionConfig() {
24         _coercionsByShape = new CoercionAction[INPUT_SHAPE_COUNT];
25         _acceptBlankAsEmpty = false;
26     }
27 
CoercionConfig(CoercionConfig src)28     protected CoercionConfig(CoercionConfig src) {
29         _acceptBlankAsEmpty = src._acceptBlankAsEmpty;
30         _coercionsByShape = Arrays.copyOf(src._coercionsByShape,
31                 src._coercionsByShape.length);
32     }
33 
findAction(CoercionInputShape shape)34     public CoercionAction findAction(CoercionInputShape shape) {
35         return _coercionsByShape[shape.ordinal()];
36     }
37 
getAcceptBlankAsEmpty()38     public Boolean getAcceptBlankAsEmpty() {
39         return _acceptBlankAsEmpty;
40     }
41 }
42