- java.lang.Object
-
- org.tentackle.model.parse.Line
-
- org.tentackle.model.parse.SingleLine
-
- org.tentackle.model.parse.AttributeLine
-
public class AttributeLine extends SingleLine
The attribute definition line.An attribute line is defined as follows:
javaType[<innerType>][(size[,scale])] javaName columnName [comment] [\[options\]]
Where:- javaType - is the java class name or primitive. Allowed types are:
- primitives: boolean, byte, char, short, int, long, float, double
- classes: Boolean, Byte, Character, Short, Integer, Long, Float, Double, BigDecimal, BMoney, DMoney, Binary, Date, Time, Timestamp, String
- innerType: optional inner/generic type
- size: optional number of columns or width or non-fractional digits if numeric
- scale: optional scale (numeric types only)
- javaName: the name used in Java sources (must start lowercase)
- columnName: the database column name
- comment: the optional comment
- [options]: the options enclosed in double quotes. Options beginning with an '@' are treated as annotations
Examples:
long subsidiaryId subsidiary_id subsidiary ID [contextid] String(10) invoiceNo invoice_no the unique invoice number [uc] Date invoiceDate invoice_date the invoice's date long customerId customer_id object ID of the customer [uc] String(200) address address the address (multiline) [default 'blah'] DMoney total total sum (without tax) DMoney tax tax tax (vat) Timestamp printed printed first printed Double(10,2) someDouble some_double digits with scale MyType<int> extra extra some application specific type
- Author:
- harald
- javaType - is the java class name or primitive. Allowed types are:
-
-
Constructor Summary
Constructors Constructor Description AttributeLine(Document document, int offset, LineType lineType)Creates an attribute line.
This line always spans only one line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetColumnName()Gets the column name in database table.StringgetComment()Gets the comment.StringgetInnerType()Gets the inner type name.StringgetJavaName()Gets the Java attribute name.StringgetJavaType()Gets the java type name.List<String>getOptions()Gets the options.IntegergetScale()Gets the numeric scale.IntegergetSize()Gets the size.voidparse()Parses a line.-
Methods inherited from class org.tentackle.model.parse.Line
assertParsed, createModelException, createModelException, getDocument, getLength, getLineNumber, getLineType, getOffset, getSourceInfo, getText, setLength, toString
-
-
-
-
Method Detail
-
parse
public void parse() throws ModelExceptionDescription copied from class:LineParses a line.- Overrides:
parsein classSingleLine- Throws:
ModelException- if parsing failed
-
getJavaType
public String getJavaType() throws ModelException
Gets the java type name.- Returns:
- the java name, never null
- Throws:
ModelException- if not parsed
-
getInnerType
public String getInnerType() throws ModelException
Gets the inner type name.- Returns:
- the inner type, null if regular type
- Throws:
ModelException- if not parsed
-
getSize
public Integer getSize() throws ModelException
Gets the size.- Returns:
- the size, null if not set
- Throws:
ModelException- if not parsed
-
getScale
public Integer getScale() throws ModelException
Gets the numeric scale.- Returns:
- the scale, null if not set
- Throws:
ModelException- if not parsed
-
getJavaName
public String getJavaName() throws ModelException
Gets the Java attribute name.- Returns:
- the java name
- Throws:
ModelException- if not parsed
-
getColumnName
public String getColumnName() throws ModelException
Gets the column name in database table.- Returns:
- the column name
- Throws:
ModelException- if not parsed
-
getComment
public String getComment() throws ModelException
Gets the comment.- Returns:
- the comment, never null
- Throws:
ModelException- if not parsed
-
getOptions
public List<String> getOptions() throws ModelException
Gets the options.- Returns:
- the options (never null)
- Throws:
ModelException- if not parsed
-
-