private String toText(Identifier identifier) {
    if (identifier == null) {
      throw new IllegalArgumentException("Identifier cannot be null; bad usage");
    }

    if (identifier.isQuoted() && storesMixedCaseQuotedIdentifiers) {
      return identifier.getText();
    } else if ((identifier.isQuoted() && storesUpperCaseQuotedIdentifiers)
        || (!identifier.isQuoted() && storesUpperCaseIdentifiers)) {
      return StringHelper.toUpperCase(identifier.getText());
    } else if ((identifier.isQuoted() && storesLowerCaseQuotedIdentifiers)
        || (!identifier.isQuoted() && storesLowerCaseIdentifiers)) {
      return StringHelper.toLowerCase(identifier.getText());
    }
    return identifier.getText();
  }
 public TableSpecification locateTable(String tableName) {
   if (tableName == null || tableName.equals(getPrimaryTableName())) {
     return primaryTable;
   }
   SecondaryTable secondaryTable = secondaryTables.get(Identifier.toIdentifier(tableName));
   if (secondaryTable == null) {
     throw new AssertionFailure(
         String.format(
             "Unable to find table %s amongst tables %s", tableName, secondaryTables.keySet()));
   }
   return secondaryTable.getSecondaryTableReference();
 }
  public Identifier toIdentifier(String text) {
    if (globallyQuoteIdentifiers) {
      return Identifier.toIdentifier(text, true);
    }

    // lovely decipher of whether the incoming value represents a quoted identifier...
    final boolean isUpperCase = text.toUpperCase().equals(text);
    final boolean isLowerCase = text.toLowerCase().equals(text);
    final boolean isMixedCase = !isLowerCase && !isUpperCase;

    if (jdbcEnvironment.getReservedWords().contains(text)) {
      // unequivocally it needs to be quoted...
      return Identifier.toIdentifier(text, true);
    }

    if (storesMixedCaseQuotedIdentifiers && isMixedCase) {
      return Identifier.toIdentifier(text, true);
    }

    if (storesLowerCaseQuotedIdentifiers && isLowerCase) {
      return Identifier.toIdentifier(text, true);
    }

    if (storesUpperCaseQuotedIdentifiers && isUpperCase) {
      return Identifier.toIdentifier(text, true);
    }

    return Identifier.toIdentifier(text);
  }
 @Override
 public Identifier toIdentifier(String text, boolean quoted) {
   return globallyQuoteIdentifiers
       ? Identifier.toIdentifier(text, true)
       : Identifier.toIdentifier(text, quoted);
 }
 /**
  * Determine the name of the column used to store the generator value in the db.
  *
  * <p>Called during {@link #configure configuration} <b>when resolving to a physical table</b>.
  *
  * @param params The params supplied in the generator config (plus some standard useful extras).
  * @param dialect The dialect in effect.
  * @return The value column name
  */
 protected Identifier determineValueColumnName(Properties params, Dialect dialect) {
   final ObjectNameNormalizer normalizer =
       (ObjectNameNormalizer) params.get(IDENTIFIER_NORMALIZER);
   final String name = ConfigurationHelper.getString(VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN);
   return Identifier.toIdentifier(normalizer.normalizeIdentifierQuoting(name));
 }
 public boolean hasTable(String tableName) {
   return tableName.equals(getPrimaryTableName())
       || secondaryTables.containsKey(Identifier.toIdentifier(tableName));
 }