java.lang.Object
org.tentackle.model.parse.Line
org.tentackle.model.parse.MultiLine
org.tentackle.model.parse.RelationLine
Describes the relation to other entities.
Syntax:
<class>: <property>=<value>[ <value> <value>], <property>=..., ...Properties:
relation = <object|list|reversed> [composite] [tracked] [referenced] [processed] [readonly|writeonly|nomethod] [serialized] [remoteclear] [reversed] [shallow] [immutable] [normtext] [blunt]
- object: single object association [1:1]. This is the default.
- reversed: non-composite list relation that contains max. one object (reversed 1:1 object relation)
- list: list of objects [1:N]. ([N:M] see below nm = ...)
- composite: relation points to a component (default if related entity's type is embedded)
- tracked: modification state of object or list is tracked
- referenced: set the parent reference on select and construction
- processed: invokes a processXXX-method on initialization, after select and before save
- readonly: don't generate set-method
- writeonly: don't generate get-method
- nomethod: don't generate set- and get-method (shorthand for readonly writeonly)
- serialized (only if lazy and not composite): lazy non-composite references are transient by default. "serialized" makes them non-transient.
- remoteclear: clear serialized relation before save (i.e. sending to server)
- shallow: exclude this relation in snapshots or copies
- immutable: set this relation immutable after initial load
- normtext: add the toString value of this relation to the normtext. If this is a list, add toStrings of all PDOs.
- blunt: the blunt-method becomes part of the persistence interface.
select = <always|eager|lazy|embedded> [cached] [| wurbletargs]
- always: fetched on every get (default if cached)
- eager: fetched in advance whenever the main class is fetched
- lazy: fetched within the first get only (default if not cached)
- embedded: fetched by parent (default if related entity's type is embedded)
- cached: use caching select methods if possible (only for objects-relations)
- wurbletargs: additional arguments passed to the PdoSelectList-wurblet (only for list-relations)
Example:select = lazy | -pilePosition
- cascade: composition is a list that contains compositions (only if model without integrity checks)
- only for composite relations: special method to set the links in composite lists or objects
in saveReferencingRelations. For example:
setBlah
.set
alone will be replaced by the corresponding method name according to the model.
The methods arguments are fixed to (this). -
[index] is an integer attribute of the referenced entity.
If [index] is set, (this, ndx) is invoked with index beginning at 0 (only for lists).
[index] may be a path to an attribute of an embedded entity, as well.
- second and more arguments passed to selectBy- or deleteBy-method. Only applicable to list relations.
Example:args = forCreditor[isCreditor()] lineType[CalculationLineType.ON_CALCULATION]
The first argument cannot be overwritten. For lists it is<name-of-current-entity>Id[getId()]
For object relations it isid[get<name-of-relation>Id()]
- methodname: is the part of the method names, i.e. select[By]<methodname>, delete[By]<methodname>,
set<methodname>
[By] is added for lists.
- relationname: name of the relation. Defaults to <class>.
The getter- and setter-names are generated as follows:
get<name> and set<name> (always first letter in uppercase) for object-relations and get<name>List, set<name>List for list-relations.
If <name> is explicitly set, the methods will be named get<name> and set<name> regardless of the relation type.
- columnprefix: the prefix to add to the column names of the related embedded PDO.
Only applicable to embedded relations!
Defaults to lowercase of <relationname> plus an underline.
For nested embedded PDOs, the prefixes are concatenated accordingly.
- entity: name of opposite entity the N:M relation.
- mnMethodName: optional method name to access the list of opposite entities.
- mnScope: optional access scope of the nm-method (defaults to scope = ...). Can be used
to hide the technical methods via
scope=private
from the interfaces and making the nm-methodpublic
.
scope = <public|private|protected|package>
- sets the scope of the generated setter/getter-methods. Defaults to public.
- sets the counter attribute. Must be numeric. Only available for composite non-reversed list relations.
- to include in getter/setter comment
- Author:
- harald
-
Constructor Summary
ConstructorDescriptionRelationLine
(Document document, int offset, LineType lineType) Creates a relation line.
A relation line may span multiple lines. -
Method Summary
Modifier and TypeMethodDescriptionGets the classname.Gets the properties.void
parse()
Parses a line.Methods inherited from class org.tentackle.model.parse.Line
assertParsed, createModelException, createModelException, getDocument, getLength, getLineNumber, getLineType, getOffset, getSourceInfo, getText, setLength, toString
-
Constructor Details
-
RelationLine
Creates a relation line.
A relation line may span multiple lines.- Parameters:
document
- the whole documentoffset
- offset to first character within documentlineType
- the line type
-
-
Method Details
-
parse
Description copied from class:Line
Parses a line.- Overrides:
parse
in classMultiLine
- Throws:
ModelException
- if parsing failed
-
getClassName
Gets the classname.- Returns:
- the classname, never null or empty
- Throws:
ModelException
- if not parsed
-
getProperties
Gets the properties.- Returns:
- the properties
- Throws:
ModelException
- if not parsed
-