Class NameValidator
java.lang.Object
com.aquima.interactions.metamodel.impl.NameValidator
This utility class validates if a name is valid to be used as identifier for an attribute, entity or instance.
- Since:
- 6.3
- Author:
- O. Kerpershoek
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This interface defines the result of a name validation. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
This method checks if the name is a keyword.static boolean
isValidIdentifier
(String name) This method validates if a name is a valid identifier.static NameValidator.IResult
validateName
(String name) This method validates the name passed to the method, and returns an error code when the name is not valid.
-
Method Details
-
validateName
This method validates the name passed to the method, and returns an error code when the name is not valid. The error code expected 2 parameters: The name and the type of object the name was validated for.- Parameters:
name
- The name that should be validated.- Returns:
- ErrorCode indicating why the name is not valid, or null when the name is valid.
-
isValidIdentifier
This method validates if a name is a valid identifier. An identifier should start with a letter, optionally followed by letters, digits, underscores or (since 8.1) at sign.- Parameters:
name
- The name that should be checked.- Returns:
- Boolean indicating if the name is a valid identifier.
-
isKeyword
This method checks if the name is a keyword.- Parameters:
name
- The name that should be checked.- Returns:
- Boolean indicating if the name represents a keyword.
-