com.fasterxml.jackson.core.format
Enum MatchStrength

java.lang.Object
  extended by java.lang.Enum<MatchStrength>
      extended by com.fasterxml.jackson.core.format.MatchStrength
All Implemented Interfaces:
Serializable, Comparable<MatchStrength>

public enum MatchStrength
extends Enum<MatchStrength>

Enumeration used to indicate strength of match between data format and piece of data (typically beginning of a data file). Values are in increasing match strength; and detectors should return "strongest" value: that is, it should start with strongest match criteria, and downgrading if criteria is not fulfilled.


Enum Constant Summary
FULL_MATCH
          Value that indicates that given data contains a signature that is deemed specific enough to uniquely indicate data format used.
INCONCLUSIVE
          Value that indicates that detector can not find out whether could be a match or not.
NO_MATCH
          Value that indicates that given data can not be in given format.
SOLID_MATCH
          Value that indicates that given data conforms to (one of) canonical form(s) of the data format.
WEAK_MATCH
          Value that indicates that given data could be of specified format (i.e.
 
Method Summary
static MatchStrength valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MatchStrength[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NO_MATCH

public static final MatchStrength NO_MATCH
Value that indicates that given data can not be in given format.


INCONCLUSIVE

public static final MatchStrength INCONCLUSIVE
Value that indicates that detector can not find out whether could be a match or not. This can occur for example for textual data formats t when there are so many leading spaces that detector can not find the first data byte (because detectors typically limit lookahead to some smallish value).


WEAK_MATCH

public static final MatchStrength WEAK_MATCH
Value that indicates that given data could be of specified format (i.e. it can not be ruled out). This can occur for example when seen data is both not in canonical formats (for example: JSON data should be a JSON Array or Object not a scalar value, as per JSON specification) and there are known use case where a format detected is actually used (plain JSON Strings are actually used, even though specification does not indicate that as valid usage: as such, seeing a leading double-quote could indicate a JSON String, which plausibly could indicate non-standard JSON usage).


SOLID_MATCH

public static final MatchStrength SOLID_MATCH
Value that indicates that given data conforms to (one of) canonical form(s) of the data format.

For example, when testing for XML data format, seeing a less-than character ("<") alone (with possible leading spaces) would be a strong indication that data could be in xml format (but see below for FULL_MATCH description for more)


FULL_MATCH

public static final MatchStrength FULL_MATCH
Value that indicates that given data contains a signature that is deemed specific enough to uniquely indicate data format used.

For example, when testing for XML data format, seing "<xml" as the first data bytes ("XML declaration", as per XML specification) could give full confidence that data is indeed in XML format. Not all data formats have unique leading identifiers to allow full matches; for example, JSON only has heuristic matches and can have at most SOLID_MATCH) match.

Method Detail

values

public static MatchStrength[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MatchStrength c : MatchStrength.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MatchStrength valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2012 FasterXML. All Rights Reserved.