• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.core.format;
2 
3 /**
4  * Enumeration used to indicate strength of match between data format
5  * and piece of data (typically beginning of a data file).
6  * Values are in increasing match strength; and detectors should return
7  * "strongest" value: that is, it should start with strongest match
8  * criteria, and downgrading if criteria is not fulfilled.
9  */
10 public enum MatchStrength
11 {
12     /**
13      * Value that indicates that given data can not be in given format.
14      */
15     NO_MATCH,
16 
17     /**
18      * Value that indicates that detector can not find out whether could
19      * be a match or not.
20      * This can occur for example for textual data formats t
21      * when there are so many leading spaces that detector can not
22      * find the first data byte (because detectors typically limit lookahead
23      * to some smallish value).
24      */
25     INCONCLUSIVE,
26 
27     /**
28      * Value that indicates that given data could be of specified format (i.e.
29      * it can not be ruled out). This can occur for example when seen data
30      * is both not in canonical formats (for example: JSON data should be a JSON Array or Object
31      * not a scalar value, as per JSON specification) and there are known use case
32      * where a format detected is actually used (plain JSON Strings are actually used, even
33      * though specification does not indicate that as valid usage: as such, seeing a leading
34      * double-quote could indicate a JSON String, which plausibly <b>could</b> indicate
35      * non-standard JSON usage).
36      */
37     WEAK_MATCH,
38 
39     /**
40      * Value that indicates that given data conforms to (one of) canonical form(s) of
41      * the data format.
42      *<p>
43      * For example, when testing for XML data format,
44      * seeing a less-than character ("&lt;") alone (with possible leading spaces)
45      * would be a strong indication that data could
46      * be in xml format (but see below for {@link #FULL_MATCH} description for more)
47      */
48     SOLID_MATCH,
49 
50     /**
51      * Value that indicates that given data contains a signature that is deemed
52      * specific enough to uniquely indicate data format used.
53      *<p>
54      * For example, when testing for XML data format,
55      * seing "&lt;xml" as the first data bytes ("XML declaration", as per XML specification)
56      * could give full confidence that data is indeed in XML format.
57      * Not all data formats have unique leading identifiers to allow full matches; for example,
58      * JSON only has heuristic matches and can have at most {@link #SOLID_MATCH}) match.
59      */
60     FULL_MATCH
61     ;
62 }
63