Tabnine Logo
IdentifierRule
Code IndexAdd Tabnine to your IDE (free)

How to use
IdentifierRule
in
org.apache.openjpa.lib.identifier

Best Java code snippets using org.apache.openjpa.lib.identifier.IdentifierRule (Showing top 20 results out of 315)

origin: org.apache.openejb.patch/openjpa

public boolean requiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException(_loc.get("no-rules-provided").getMessage());
  }
  if (rule.getCanDelimit() && !isDelimited(config, rule, name) && rule.requiresDelimiters(name)) {
    return true;
  }
  return false;
}

origin: org.apache.openjpa/openjpa-all

if (getMustDelimit()) {
  return true;
if (isMustBeginWithLetter()) {
  if (!Character.isJavaIdentifierStart(chars[0])) {
    return true;
  if (isOnlyLettersDigitsUnderscores()) {
    if (!Character.isJavaIdentifierPart(ch) && !(ch == UNDERSCORE)) {
      return true;
  if (StringUtil.contains(getSpecialCharacters(), ch)) {
    return true;
if (getDelimitReservedWords()) {
  if (isReservedWord(identifier)) {
    return true;
origin: org.apache.openjpa/openjpa-lib

/**
 * Returns whether a name is considered a reserved word.
 */
public boolean isReservedWord(IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException("Naming rule is null!");
  }
  if (rule.getReservedWords() == null) {
    return false;
  }
  if (!isDelimited(rule, name)) {
    name = name.toUpperCase(Locale.ENGLISH);
  }
  return rule.getReservedWords().contains(name);
}
origin: org.apache.openejb.patch/openjpa-jdbc

/**
 * Converts the identifier to a format appropriate for the configuration using
 * the default naming rule.
 * @param delimit If false, do not delimit.  Otherwise, delimit if necessary.
 */
public String toDBName(String name, boolean delimit) {
  return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit);
}
origin: org.apache.openjpa/openjpa-all

private int getMaxLen(String rule, DBIdentifier name, int maxLen) {
  IdentifierConfiguration config = getIdentifierConfiguration();
  if (maxLen < 1) {
    IdentifierRule nrule = config.getIdentifierRule(rule);
    maxLen = nrule.getMaxLength();
  }
  // Subtract delimiter length if name is delimited or will be delimited
  if (config.delimitAll() || name.isDelimited()) {
    maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length());
  }
  
  return maxLen;
}

origin: org.apache.openejb.patch/openjpa

public String delimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force) {
  if (!rule.getCanDelimit() || StringUtils.isEmpty(name)) {
    return name;
  }
  if ((force && !isDelimited(config, rule, name)) || requiresDelimiters(config, rule, name)) {
    return config.getLeadingDelimiter() + name + config.getTrailingDelimiter();
  }
  return name;
}
origin: org.apache.openjpa/openjpa-jdbc

/**
 * Converts the identifier to a format appropriate for the configuration using
 * the default naming rule.
 * @param delimit If false, do not delimit.  Otherwise, delimit if necessary.
 */
public String toDBName(String name, boolean delimit) {
  return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit);
}
origin: org.apache.openjpa/openjpa-jdbc

private int getMaxLen(String rule, DBIdentifier name, int maxLen) {
  IdentifierConfiguration config = getIdentifierConfiguration();
  if (maxLen < 1) {
    IdentifierRule nrule = config.getIdentifierRule(rule);
    maxLen = nrule.getMaxLength();
  }
  // Subtract delimiter length if name is delimited or will be delimited
  if (config.delimitAll() || name.isDelimited()) {
    maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length());
  }
  
  return maxLen;
}

origin: org.apache.openjpa/openjpa-all

public String delimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force) {
  if (!rule.getCanDelimit() || StringUtil.isEmpty(name)) {
    return name;
  }
  if ((force && !isDelimited(config, rule, name)) || requiresDelimiters(config, rule, name)) {
    return config.getLeadingDelimiter() + name + config.getTrailingDelimiter();
  }
  return name;
}
origin: org.apache.openjpa/openjpa-lib

if (getMustDelimit()) {
  return true;
if (isMustBeginWithLetter()) {
  if (!Character.isJavaIdentifierStart(chars[0])) {
    return true;
  if (isOnlyLettersDigitsUnderscores()) {
    if (!Character.isJavaIdentifierPart(ch) && !(ch == UNDERSCORE)) {
      return true;
  if (StringUtil.contains(getSpecialCharacters(), ch)) {
    return true;
if (getDelimitReservedWords()) {
  if (isReservedWord(identifier)) {
    return true;
origin: org.apache.openjpa/openjpa-all

public boolean requiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException(_loc.get("no-rules-provided").getMessage());
  }
  if (rule.getCanDelimit() && !isDelimited(config, rule, name) && rule.requiresDelimiters(name)) {
    return true;
  }
  return false;
}

origin: org.apache.openejb.patch/openjpa

/**
 * Converts the identifier to a format appropriate for the configuration using
 * the default naming rule.
 * @param delimit If false, do not delimit.  Otherwise, delimit if necessary.
 */
public String toDBName(String name, boolean delimit) {
  return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit);
}
origin: org.apache.openejb.patch/openjpa

private int getMaxLen(String rule, DBIdentifier name, int maxLen) {
  IdentifierConfiguration config = getIdentifierConfiguration();
  if (maxLen < 1) {
    IdentifierRule nrule = config.getIdentifierRule(rule);
    maxLen = nrule.getMaxLength();
  }
  // Subtract delimiter length if name is delimited or will be delimited
  if (config.delimitAll() || name.isDelimited()) {
    maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length());
  }
  
  return maxLen;
}

origin: org.apache.openjpa/openjpa-lib

public String delimit(IdentifierConfiguration config, IdentifierRule rule, String name, boolean force) {
  if (!rule.getCanDelimit() || StringUtil.isEmpty(name)) {
    return name;
  }
  if ((force && !isDelimited(config, rule, name)) || requiresDelimiters(config, rule, name)) {
    return config.getLeadingDelimiter() + name + config.getTrailingDelimiter();
  }
  return name;
}
origin: org.apache.openjpa/openjpa-all

/**
 * Returns whether a name is considered a reserved word.
 */
public boolean isReservedWord(IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException("Naming rule is null!");
  }
  if (rule.getReservedWords() == null) {
    return false;
  }
  if (!isDelimited(rule, name)) {
    name = name.toUpperCase(Locale.ENGLISH);
  }
  return rule.getReservedWords().contains(name);
}
origin: org.apache.openejb.patch/openjpa

if (getMustDelimit()) {
  return true;
if (isMustBeginWithLetter()) {
  if (!CharUtils.isAsciiAlpha(chars[0])) {
    return true;
  if (isOnlyLettersDigitsUnderscores()) {
    if (!CharUtils.isAsciiAlphanumeric(ch) && !(ch == UNDERSCORE)) {
      return true;
  if (StringUtils.contains(getSpecialCharacters(), ch)) {
    return true;
if (getDelimitReservedWords()) {
  if (isReservedWord(identifier)) {
    return true;
origin: org.apache.openjpa/openjpa-lib

public boolean requiresDelimiters(IdentifierConfiguration config, IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException(_loc.get("no-rules-provided").getMessage());
  }
  if (rule.getCanDelimit() && !isDelimited(config, rule, name) && rule.requiresDelimiters(name)) {
    return true;
  }
  return false;
}

origin: org.apache.openjpa/openjpa-all

/**
 * Converts the identifier to a format appropriate for the configuration using
 * the default naming rule.
 * @param delimit If false, do not delimit.  Otherwise, delimit if necessary.
 */
public String toDBName(String name, boolean delimit) {
  return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit);
}
origin: org.apache.openejb.patch/openjpa-jdbc

private int getMaxLen(String rule, DBIdentifier name, int maxLen) {
  IdentifierConfiguration config = getIdentifierConfiguration();
  if (maxLen < 1) {
    IdentifierRule nrule = config.getIdentifierRule(rule);
    maxLen = nrule.getMaxLength();
  }
  // Subtract delimiter length if name is delimited or will be delimited
  if (config.delimitAll() || name.isDelimited()) {
    maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length());
  }
  
  return maxLen;
}

origin: org.apache.openejb.patch/openjpa

/**
 * Returns whether a name is considered a reserved word.
 */
public boolean isReservedWord(IdentifierRule rule, String name) {
  if (rule == null) {
    throw new IllegalArgumentException("Naming rule is null!");
  }
  if (rule.getReservedWords() == null) {
    return false;
  }
  if (!isDelimited(rule, name)) {
    name = name.toUpperCase();
  }
  return rule.getReservedWords().contains(name);
}
org.apache.openjpa.lib.identifierIdentifierRule

Javadoc

The standard identifier rule. Rules are used for specific configuration of identifier types. For example. A rule could be used to indicate that an identifier type should not be delimited or has a max length of 255 characters.

Most used methods

  • getMaxLength
  • getName
  • getCanDelimit
  • getDelimitReservedWords
  • getMustDelimit
  • getReservedWords
  • getSpecialCharacters
  • isMustBeginWithLetter
  • isOnlyLettersDigitsUnderscores
  • isReservedWord
  • requiresDelimiters
    SQL identifier rules: 1) Can be up to 128 characters long 2) Must begin with a letter 3) Can contain
  • requiresDelimiters

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Collectors (java.util.stream)
  • JCheckBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now