Top Description Fields Constructors Methods
tools.jackson.core.sym

public abstract Class PropertyNameMatcher

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
tools.jackson.core.sym.HashedMatcherBase
Imports
java.util.ArrayList, .List, .Locale, tools.jackson.core.util.InternCache, .Named

Interface for implementations used for efficient matching of Object property names from input stream (via parser) to higher-level abstractions like properties that databind uses. Used to avoid two-phase lookups -- first from input stream to strings; then from strings to entities -- but details may heavily depend on format parser (some formats can optimize better than others).
Since
3.0

Field Summary

Modifier and TypeField and Description
protected final PropertyNameMatcher
protected final Locale
_locale

Since case-handling is Locale-specific in some (rare) cases, need to hold on to configured Locale.

protected final String[]
private static final InternCache
public static final int
MATCH_END_OBJECT

Marker for case where JsonToken.END_OBJECT encountered.

public static final int
MATCH_ODD_TOKEN

Marker for case where token encountered is neither PROPERTY_NAME nor END_OBJECT.

public static final int
MATCH_UNKNOWN_NAME

Marker for case where property name encountered but not one of matches.

private static final long

Constructor Summary

AccessConstructor and Description
protected
PropertyNameMatcher(Locale locale, PropertyNameMatcher backup, String[] nameLookup)

Method Summary

Modifier and TypeMethod and Description
protected static int
_findSize(int size)

protected static String
_fromName(Named n, boolean alreadyInterned)

protected static final int
_hash(int h, int mask)

protected static List<String>
_lc(Locale locale, List<String> src)

public abstract int
matchByQuad(int q1)

public abstract int
matchByQuad(int q1, int q2)

public abstract int
matchByQuad(int q1, int q2, int q3)

public abstract int
matchByQuad(int[] q, int qlen)

public abstract int

Returns:

Index of the name matched, if any (non-negative number); or an error code (negative constant MATCH_xxx) if none
matchName
(String
Name to match
toMatch
)

Lookup method that does not assume name to be matched to be String#interned (although passing interned String is likely to result in more efficient matching).

protected int

Returns:

Index for the match, if any (non-negative); or error code if no match
matchSecondary
(String
Name to match
toMatch
)

Secondary lookup method used for matchers that operate with more complex matching rules, such as case-insensitive matchers.

public final String[]

Returns:

Array of names that this matcher may match (with indices that match non-negative values by matchXxx methods)
nameLookup
()

Accessor to names matching indexes, iff passed during construction.

public static List<String>
stringsFromNames(List<Named> properties, final boolean alreadyInterned)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_backupMatcherback to summary
protected final PropertyNameMatcher _backupMatcher
_localeback to summary
protected final Locale _locale

Since case-handling is Locale-specific in some (rare) cases, need to hold on to configured Locale.

_nameLookupback to summary
protected final String[] _nameLookup
INTERNERback to summary
private static final InternCache INTERNER
MATCH_END_OBJECTback to summary
public static final int MATCH_END_OBJECT

Marker for case where JsonToken.END_OBJECT encountered.

MATCH_ODD_TOKENback to summary
public static final int MATCH_ODD_TOKEN

Marker for case where token encountered is neither PROPERTY_NAME nor END_OBJECT.

MATCH_UNKNOWN_NAMEback to summary
public static final int MATCH_UNKNOWN_NAME

Marker for case where property name encountered but not one of matches.

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

PropertyNameMatcherback to summary
protected PropertyNameMatcher(Locale locale, PropertyNameMatcher backup, String[] nameLookup)

Method Detail

_findSizeback to summary
protected static int _findSize(int size)
_fromNameback to summary
protected static String _fromName(Named n, boolean alreadyInterned)
_hashback to summary
protected static final int _hash(int h, int mask)
_lcback to summary
protected static List<String> _lc(Locale locale, List<String> src)
matchByQuadback to summary
public abstract int matchByQuad(int q1)
matchByQuadback to summary
public abstract int matchByQuad(int q1, int q2)
matchByQuadback to summary
public abstract int matchByQuad(int q1, int q2, int q3)
matchByQuadback to summary
public abstract int matchByQuad(int[] q, int qlen)
matchNameback to summary
public abstract int matchName(String toMatch)

Lookup method that does not assume name to be matched to be String#interned (although passing interned String is likely to result in more efficient matching).

Parameters
toMatch:String

Name to match

Returns:int

Index of the name matched, if any (non-negative number); or an error code (negative constant MATCH_xxx) if none

matchSecondaryback to summary
protected int matchSecondary(String toMatch)

Secondary lookup method used for matchers that operate with more complex matching rules, such as case-insensitive matchers.

Parameters
toMatch:String

Name to match

Returns:int

Index for the match, if any (non-negative); or error code if no match

nameLookupback to summary
public final String[] nameLookup()

Accessor to names matching indexes, iff passed during construction.

Returns:String[]

Array of names that this matcher may match (with indices that match non-negative values by matchXxx methods)

stringsFromNamesback to summary
public static List<String> stringsFromNames(List<Named> properties, final boolean alreadyInterned)