Package ru.curs.celesta.score
Class NamedElement
- java.lang.Object
-
- ru.curs.celesta.score.NamedElement
-
- Direct Known Subclasses:
Column
,Grain
,GrainElement
,Parameter
public abstract class NamedElement extends Object
A named element of metamodel (e.g. table or column) that must have a unique identifier name.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_IDENTIFIER_LENGTH
The maximal length of an identifier of Celesta.
-
Constructor Summary
Constructors Constructor Description NamedElement(String name, IdentifierParser identifierParser)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getCelestaDoc()
Returns value of document string for this element.String
getName()
Returns the name.String
getQuotedName()
Returns the name in ANSI quotes (e.g.String
getQuotedNameIfNeeded()
Returns the name in ANSI quotes if needed.int
hashCode()
static String
limitName(String value)
Restricts identifier length by maximal number of symbols.static String
limitName(String value, String postfix)
Restricts identifier length with a postfix by maximal number of symbols.void
setCelestaDoc(String celestaDoc)
Sets value of document string.
-
-
-
Field Detail
-
MAX_IDENTIFIER_LENGTH
public static final int MAX_IDENTIFIER_LENGTH
The maximal length of an identifier of Celesta.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NamedElement
public NamedElement(String name, IdentifierParser identifierParser) throws ParseException
- Throws:
ParseException
-
-
Method Detail
-
limitName
public static String limitName(String value)
Restricts identifier length by maximal number of symbols.- Parameters:
value
- Identifier of arbitrary length.- Returns:
- "Shortcut" identifier that has a hash code of the original one as its last 8 symbols.
-
limitName
public static String limitName(String value, String postfix)
Restricts identifier length with a postfix by maximal number of symbols. The resulting form becomes: <restricted identifier><postfix>. For example my_very_long_table_name with _nextValueProc becomes - my_very_73FAF9A9_nextValueProc- Parameters:
value
- Identifier of arbitrary length.postfix
- Identifier postfix.- Returns:
- "Shortcut" identifier that has a hash code of the original one as its last 8 symbols plus postfix.
-
getName
public final String getName()
Returns the name.
-
getQuotedName
public final String getQuotedName()
Returns the name in ANSI quotes (e.g. "celestaIdentifier").
-
getQuotedNameIfNeeded
public final String getQuotedNameIfNeeded()
Returns the name in ANSI quotes if needed.- Returns:
-
getCelestaDoc
public String getCelestaDoc()
Returns value of document string for this element.- Returns:
-
setCelestaDoc
public void setCelestaDoc(String celestaDoc) throws ParseException
Sets value of document string.- Parameters:
celestaDoc
- new value- Throws:
ParseException
- incorrect CelestaDoc
-
-