Class PropertyNameMatcher

java.lang.Object
tools.jackson.core.sym.PropertyNameMatcher
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HashedMatcherBase

public abstract class PropertyNameMatcher extends Object implements Serializable
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 Details

    • MATCH_END_OBJECT

      public static final int MATCH_END_OBJECT
      Marker for case where JsonToken.END_OBJECT encountered.
      See Also:
    • MATCH_UNKNOWN_NAME

      public static final int MATCH_UNKNOWN_NAME
      Marker for case where property name encountered but not one of matches.
      See Also:
    • MATCH_ODD_TOKEN

      public static final int MATCH_ODD_TOKEN
      Marker for case where token encountered is neither PROPERTY_NAME nor END_OBJECT.
      See Also:
    • _nameLookup

      protected final String[] _nameLookup
    • _backupMatcher

      protected final PropertyNameMatcher _backupMatcher
    • _locale

      protected final Locale _locale
      Since case-handling is Locale-specific in some (rare) cases, need to hold on to configured Locale.
  • Constructor Details

  • Method Details

    • matchName

      public abstract int matchName(String toMatch)
      Lookup method that does not assume name to be matched to be String.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

      public final String[] 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 matchXxx methods)
    • matchSecondary

      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 - 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

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

      protected static String _fromName(Named n, boolean alreadyInterned)
    • _lc

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