java.lang.Object
tools.jackson.core.sym.PropertyNameMatcher
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
HashedMatcherBase
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
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PropertyNameMatcherprotected final LocaleSince case-handling is Locale-specific in some (rare) cases, need to hold on to configured Locale.protected final String[]static final intMarker for case whereJsonToken.END_OBJECTencountered.static final intMarker for case where token encountered is neitherPROPERTY_NAMEnorEND_OBJECT.static final intMarker for case where property name encountered but not one of matches. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPropertyNameMatcher(Locale locale, PropertyNameMatcher backup, String[] nameLookup) -
Method Summary
Modifier and TypeMethodDescriptionprotected static int_findSize(int size) protected static Stringprotected static final int_hash(int h, int mask) abstract intmatchByQuad(int q1) abstract intmatchByQuad(int[] q, int qlen) abstract intmatchByQuad(int q1, int q2) abstract intmatchByQuad(int q1, int q2, int q3) abstract intLookup method that does not assume name to be matched to beString.intern()ed (although passing interned String is likely to result in more efficient matching).protected intmatchSecondary(String toMatch) Secondary lookup method used for matchers that operate with more complex matching rules, such as case-insensitive matchers.final String[]Accessor to names matching indexes, iff passed during construction.stringsFromNames(List<Named> properties, boolean alreadyInterned)
-
Field Details
-
MATCH_END_OBJECT
public static final int MATCH_END_OBJECTMarker for case whereJsonToken.END_OBJECTencountered.- See Also:
-
MATCH_UNKNOWN_NAME
public static final int MATCH_UNKNOWN_NAMEMarker for case where property name encountered but not one of matches.- See Also:
-
MATCH_ODD_TOKEN
public static final int MATCH_ODD_TOKENMarker for case where token encountered is neitherPROPERTY_NAMEnorEND_OBJECT.- See Also:
-
_nameLookup
-
_backupMatcher
-
_locale
Since case-handling is Locale-specific in some (rare) cases, need to hold on to configured Locale.
-
-
Constructor Details
-
PropertyNameMatcher
-
-
Method Details
-
matchName
Lookup method that does not assume name to be matched to beString.intern()ed (although passing interned String is likely to result in more efficient matching).- Parameters:
toMatch- Name to match- Returns:
- Index of the name matched, if any (non-negative number); or an
error code (negative constant
MATCH_xxx) if none
-
matchByQuad
public abstract int matchByQuad(int q1) -
matchByQuad
public abstract int matchByQuad(int q1, int q2) -
matchByQuad
public abstract int matchByQuad(int q1, int q2, int q3) -
matchByQuad
public abstract int matchByQuad(int[] q, int qlen) -
nameLookup
Accessor to names matching indexes, iff passed during construction.- Returns:
- Array of names that this matcher may match (with indices that
match non-negative values by
matchXxxmethods)
-
matchSecondary
Secondary lookup method used for matchers that operate with more complex matching rules, such as case-insensitive matchers.- Parameters:
toMatch- Name to match- Returns:
- Index for the match, if any (non-negative); or error code if no match
-
_hash
protected static final int _hash(int h, int mask) -
_findSize
protected static int _findSize(int size) -
stringsFromNames
-
_fromName
-
_lc
-