public class Identifier
extends java.lang.Object
The names of objects are mostly taken from the Excel input data, beginning with the name of the workbook, which may be derived from the file name and continuing with the names of worksheets taken from the tabs in the Excel workbook. These names will typically contain natural elements like blanks or special characters, which can be disturbing, when rendering the data model as kind of program code (source code of programming languages or scripting code). Therefore these names are stored as objects of class Identifier, which behave basically like Strings in a StringTemplate V4 template beside that their normal rendering incorporates the transformation of the natural notation in one, which is compliant with the identifier of most programming languages. The natural notation can still be addressed from a template through a dedicated field.
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
givenName
The natural, given name of the object.
|
java.lang.String |
ident
The name of the object as an identifier as defined in many programming languages,
e.g.
|
boolean |
identEquals
This flag indicates whether the given name of the object and the name of the object
as identifier
ident are identical. |
java.lang.String |
identStrict
The name of the object as a more restricted identifier as for
ident. |
boolean |
identStrictEquals
This flag indicates whether the given name of the object and the name of the object
as strict identifier
identStrict are identical. |
| Constructor and Description |
|---|
Identifier(java.lang.String name)
A new instance of Identifier is created from a normal String.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
getUniqueId()
Get the next unique ID, useful for a new object of the data model.
|
static java.lang.String |
identifierfy(java.lang.String name,
boolean isStrict)
Modify a character string carefully, such that it becomes an identifier.
|
static void |
setErrorContext(excelExporter.excelParser.ErrorCounter errCnt,
java.lang.String context)
Set the error context.
|
java.lang.String |
toString()
Return the name of the object that is designated by this Identifier as an
identifier.
|
public final java.lang.String givenName
<group.name.givenName>.public final java.lang.String ident
ident can
be considered a kind of corrected version of givenName.All groups of unpermitted characters are replaced by a single character x and an underscore prepends the resut if it should begin with a digit.
This field can be accessed as any normal, public filed, but its value is the
result of toString(), too. The usual way to refer to the value of this field
from a StringTemplate V4 template will look like <object.name> but the more
explicit <object.name.ident> would yield the same.
public final java.lang.String identStrict
ident. The
first character may be a letter, all others may be the same or a decimal digit. In
a code generation environment, identStrict can be considered a kind of
corrected version of givenName.All groups of unpermitted characters are replaced by a single character x and a further x prepends the result if it should begin with a digit.
public final boolean identEquals
ident are identical.public final boolean identStrictEquals
identStrict are identical.public Identifier(java.lang.String name)
name - The natural name of the object designated by the new Identifier object.public static void setErrorContext(excelExporter.excelParser.ErrorCounter errCnt,
java.lang.String context)
errCnt - The error counter to be used from now. Must not be null.context - A text fragment, which will prepend all logging messages of this module. Can be null
if no such common fragment is required.public static int getUniqueId()
public static java.lang.String identifierfy(java.lang.String name,
boolean isStrict)
name - The processed character string; usually the name of an object.isStrict - Boolean switch if the strict identifier or the less restrictive from the C syntax is
supported. If true then the more strict kind of identifier is supported,
which doesn't allow the underscore.public java.lang.String toString()
toString in class java.lang.Object