Class SnakeCaseColumnNameMatcher

java.lang.Object
org.jdbi.v3.core.mapper.reflect.SnakeCaseColumnNameMatcher
All Implemented Interfaces:
ColumnNameMatcher

public class SnakeCaseColumnNameMatcher extends Object implements ColumnNameMatcher
Matches snake case column names to java camel case names, ignoring case.

Example: column names first_name or FIRST_NAME would match java name firstName.

  • Constructor Details

    • SnakeCaseColumnNameMatcher

      public SnakeCaseColumnNameMatcher()
  • Method Details

    • columnNameMatches

      public boolean columnNameMatches(String columnName, String javaName)
      Description copied from interface: ColumnNameMatcher
      Returns whether the column name fits the given Java identifier name.
      Specified by:
      columnNameMatches in interface ColumnNameMatcher
      Parameters:
      columnName - the SQL column name
      javaName - the Java property, field, or parameter name
      Returns:
      whether the given names are logically equivalent
    • columnNameStartsWith

      public boolean columnNameStartsWith(String columnName, String prefix)
      Description copied from interface: ColumnNameMatcher
      Return whether the column name starts with the given prefix, according to the matching strategy of this ColumnNameMatcher. This method is used by reflective mappers to short-circuit nested mapping when no column names begin with the nested prefix. By default, this method returns columnName.startWith(prefix). Third party implementations should override this method to match prefixes by the same criteria as ColumnNameMatcher.columnNameMatches(String, String).
      Specified by:
      columnNameStartsWith in interface ColumnNameMatcher
      Parameters:
      columnName - the column name to test
      prefix - the prefix to test for
      Returns:
      whether the column name begins with the prefix.
    • toString

      public String toString()
      Overrides:
      toString in class Object