Class NameVerifierImpl

java.lang.Object
org.tentackle.model.impl.NameVerifierImpl
All Implemented Interfaces:
NameVerifier

@Service(NameVerifier.class) public class NameVerifierImpl extends Object implements NameVerifier
Default implementation of a NameVerifier.
  • Constructor Details

    • NameVerifierImpl

      public NameVerifierImpl()
      Creates the name verifier.
  • Method Details

    • verifyEntityName

      public String verifyEntityName(Entity entity)
      Description copied from interface: NameVerifier
      Verifies the Java name of an entity.
      Specified by:
      verifyEntityName in interface NameVerifier
      Parameters:
      entity - the entity
      Returns:
      null if ok, else a diagnostic message
    • verifyTableName

      public String verifyTableName(Entity entity)
      Description copied from interface: NameVerifier
      Verifies the table name of an entity.
      Specified by:
      verifyTableName in interface NameVerifier
      Parameters:
      entity - the entity
      Returns:
      null if ok, else a diagnostic message
    • verifyTableAlias

      public String verifyTableAlias(Entity entity)
      Description copied from interface: NameVerifier
      Verifies the table alias of an entity.
      Specified by:
      verifyTableAlias in interface NameVerifier
      Parameters:
      entity - the entity
      Returns:
      null if ok, else a diagnostic message
    • verifyAttributeName

      public String verifyAttributeName(Attribute attribute)
      Description copied from interface: NameVerifier
      Verifies the Java name of an attribute.
      Specified by:
      verifyAttributeName in interface NameVerifier
      Parameters:
      attribute - the attribute
      Returns:
      null if ok, else a diagnostic message
    • verifyRelationName

      public String verifyRelationName(Relation relation)
      Description copied from interface: NameVerifier
      Verifies the Java name of a relation.
      Specified by:
      verifyRelationName in interface NameVerifier
      Parameters:
      relation - the relation
      Returns:
      null if ok, else a diagnostic message
    • verifyColumnName

      public String verifyColumnName(Attribute attribute)
      Description copied from interface: NameVerifier
      Verifies the column name of an attribute.
      Specified by:
      verifyColumnName in interface NameVerifier
      Parameters:
      attribute - the attribute
      Returns:
      null if ok, else a diagnostic message
    • verifyIndexName

      public String verifyIndexName(Index index)
      Description copied from interface: NameVerifier
      Verifies the name of an index.
      Specified by:
      verifyIndexName in interface NameVerifier
      Parameters:
      index - the index
      Returns:
      null if ok, else a diagnostic message
    • isAllUpperOrLowerCase

      protected boolean isAllUpperOrLowerCase(String name, Entity entity)
      Checks whether the given name is all upper- or all lowercase.
      The backends are usually not case-sensitive (unless the SQL names are quoted), but it is good style to either use all upper- or all lowercase. Mixing the case pretends that the case is important, but in fact it's not. This is only allowed for provided entities.
      Parameters:
      name - the name
      entity - the entity
      Returns:
      true if ok, false if mixed
    • isNotQuotedOrProvided

      protected boolean isNotQuotedOrProvided(String name, Entity entity)
      Checks whether the name is quoted.
      Parameters:
      name - the name
      entity - the entity
      Returns:
      true if not quoted or entity is provided by another application
    • validateJavaIdentifier

      protected String validateJavaIdentifier(String name)
      Validates the given name against the rules for Java identifiers and possible conflicts with method names in superclasses.
      Parameters:
      name - the attribute or relation name
      Returns:
      null if ok, else error message
    • getIllegalNames

      protected Set<String> getIllegalNames()
      Gets the set of illegal names.
      Returns:
      illegal model names
    • getConfusingNames

      protected Set<String> getConfusingNames()
      Gets the set of confusing names.
      Returns:
      confusing model name