public class RelationImpl extends Object implements Relation, Comparable<RelationImpl>
| Modifier and Type | Field and Description |
|---|---|
static String |
ARGS
property args = ...
|
static String |
CACHED
cached selection flag.
|
static String |
CASCADE
cascade delete flag.
|
static String |
COMMENT
property comment = ...
|
static String |
COMPOSITE
composite relation flag.
|
static String |
COUNT
property count = ...
|
static String |
DEFAULT
property default (if object non-composite lazy).
|
static String |
DELETE
property delete = ...
|
static String |
LINK
property link = ...
|
static String |
METHOD
property method = ...
|
static String |
NAME
property name = ...
|
static String |
NM
property nm = ...
|
static String |
NOMETHOD
readonly + writeonly.
|
static String |
PROCESSED
processed relation flag.
|
static String |
READONLY
readonly relation flag.
|
static String |
REFERENCED
referenced relation flag.
|
static String |
RELATION
property relation = ...
|
static String |
REMOTECLEAR
clear-on-remote-save relation flag.
|
static String |
REVERSED
map list relation to reversed 1:1 object relation.
|
static String |
SCOPE
property scope = ...
|
static String |
SELECT
property select = ...
|
static String |
SERIALIZED
serialized relation flag.
|
static String |
TRACKED
tracked relation flag.
|
static String |
WRITEONLY
writeonly relation flag.
|
| Constructor and Description |
|---|
RelationImpl(Entity entity,
SourceInfo sourceInfo)
Creates a relation.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(RelationImpl o) |
ModelException |
createModelException(String message)
Creates a model exception.
|
boolean |
equals(Object obj) |
AccessScope |
getAccessScope()
Gets the access scope for generated methods.
|
List<String> |
getAnnotations()
list of annotations.
|
Attribute |
getAttribute()
Gets the associated attribute.
|
String |
getClassName()
Gets the name of the related class.
|
String |
getComment()
Gets the comment.
|
Attribute |
getCountAttribute()
Returns the attribute that holds the number of elements of a 1:N relation.
Applies only to composite non-reversed list relations. If set, this column gets the number of elements in the list when the PDO is persisted. |
String |
getDeclaredJavaType(boolean withinForeignEntity)
Gets the declared java type of the relation.
|
Relation |
getDefiningNmRelation()
Gets the relation of the entity defining the nm-relation.
|
Entity |
getEntity()
Gets the entity this relation belongs to.
|
Attribute |
getForeignAttribute()
Gets the foreign attribute.
|
Entity |
getForeignEntity()
Gets the related entity.
|
Relation |
getForeignRelation()
Gets the foreign (opposite) relation.
|
String |
getGetterName()
Gets the getter method name.
|
String |
getGetterSetterComment()
Gets the comment line for getter and setter.
|
String |
getJavaType()
Gets the effective java type of the relation.
|
String |
getLinkMethodIndex()
Returns the optional link method index parameter.
|
String |
getLinkMethodName()
Gets the name for the link method.
|
List<MethodArgument> |
getMethodArgs()
Gets the effective method arguments for select- and delete-methods.
|
String |
getMethodName()
Gets the name-part for select- and delete-methods.
|
String |
getMethodNameSuffix()
Gets the suffix to be used in methodnames.
|
String |
getName()
Gets the name of this relation.
If no explicit name set, it defaults to the className. |
String |
getNmMethodName()
Same as
Relation.getMethodName() but for nm relation. |
String |
getNmName()
Gets the name of the nm-relation.
|
Relation |
getNmRelation()
Gets the N:M relation of the foreign entity.
|
ModelElement |
getParent()
Gets the parent element.
|
RelationType |
getRelationType()
Gets the relation type.
|
SelectionType |
getSelectionType()
Gets the selection type.
|
String |
getSelectionWurbletArguments()
Gets the optional wurblet arguments.
Only available for composite list relations. |
String |
getSetterName()
Gets the setter method name.
|
SourceInfo |
getSourceInfo()
Gets the source info.
|
RelationLine |
getSourceLine()
Gets the source line.
|
String |
getVariableName()
Gets the variable name.
|
int |
hashCode() |
boolean |
isClearOnRemoteSave()
Returns whether the relation should be cleared before save.
Used for non-composite serialized relations that should not be transmitted to the server. |
boolean |
isComposite()
Returns whether the relation points to components of a composite.
|
boolean |
isDeepReference()
Returns whether this relation is a deep reference.
Deep references point to components of another composite entity. |
boolean |
isDeletionCascaded()
Returns whether deletion is cascaded to elements in lists.
|
boolean |
isDeletionFromMainClass()
Returns whether delete method is invoked on main class instead of relation class.
|
boolean |
isProcessed()
Returns whether a process-method is invoked after initialization, select and before save.
The method has the same name as the getter with "get" replaced by "process" and must be provided by the application. This flag applies to composite relations only. |
boolean |
isReadOnly()
Returns whether the relation is read only.
|
boolean |
isReferenced()
Returns whether the parent object is referenced by a variable.
|
boolean |
isReversed()
Returns whether this is list relation with only one element.
A.k.a. |
boolean |
isSelectionCached()
Returns whether the select method is a caching one.
|
boolean |
isSerialized()
Returns whether the relation is serialized.
Used for non-composite relations to make them non-transient. |
boolean |
isTracked()
Returns whether the modification state of the relation is available.
|
boolean |
isWriteOnly()
Returns whether the relation is write-only.
|
void |
parse(Entity entity,
RelationLine line)
Parses a relation line.
|
void |
setAccessScope(AccessScope accessScope) |
void |
setAnnotations(List<String> annotations) |
void |
setAttribute(Attribute attribute) |
void |
setClassName(String className) |
void |
setClearOnRemoteSave(boolean clearOnRemoteSave) |
void |
setComment(String comment) |
void |
setComposite(boolean composite) |
void |
setCountAttribute(Attribute countAttribute) |
void |
setDeepReference(boolean deepReference) |
void |
setDefiningNmRelation(Relation definingNmRelation) |
void |
setDeletionCascaded(boolean deletionCascaded) |
void |
setDeletionFromMainClass(boolean deletionFromMainClass) |
void |
setForeignAttribute(Attribute foreignAttribute) |
void |
setForeignEntity(Entity foreignEntity) |
void |
setForeignRelation(Relation foreignRelation) |
void |
setLinkMethodIndex(String linkMethodIndex) |
void |
setLinkMethodName(String linkMethodName) |
void |
setMethodArgs(List<MethodArgument> methodArgs) |
void |
setMethodName(String methodName) |
void |
setName(String name) |
void |
setNmMethodName(String nmMethodName) |
void |
setNmName(String nmName) |
void |
setNmRelation(Relation nmRelation) |
void |
setProcessed(boolean processed) |
void |
setReadOnly(boolean readOnly) |
void |
setReferenced(boolean referenced) |
void |
setRelationType(RelationType relationType) |
void |
setReversed(boolean reversed) |
void |
setSelectionCached(boolean selectionCached) |
void |
setSelectionType(SelectionType selectionType) |
void |
setSelectionWurbletArguments(String selectionWurbletArguments) |
void |
setSerialized(boolean serialized) |
void |
setSourceLine(RelationLine sourceLine)
Sets the source line.
|
void |
setTracked(boolean tracked) |
void |
setWriteOnly(boolean writeOnly) |
String |
toString() |
void |
validate()
Validates the relation.
|
public static final String DEFAULT
public static final String RELATION
public static final String SELECT
public static final String DELETE
public static final String LINK
public static final String ARGS
public static final String NM
public static final String METHOD
public static final String NAME
public static final String SCOPE
public static final String COMMENT
public static final String COUNT
public static final String COMPOSITE
public static final String TRACKED
public static final String REFERENCED
public static final String PROCESSED
public static final String READONLY
public static final String WRITEONLY
public static final String NOMETHOD
public static final String SERIALIZED
public static final String REMOTECLEAR
public static final String REVERSED
public static final String CACHED
public static final String CASCADE
public RelationImpl(Entity entity, SourceInfo sourceInfo)
entity - the entity this relation belongs tosourceInfo - the source infopublic SourceInfo getSourceInfo()
getSourceInfo in interface ModelElementpublic ModelElement getParent()
ModelElementgetParent in interface ModelElementpublic int compareTo(RelationImpl o)
compareTo in interface Comparable<RelationImpl>public void parse(Entity entity, RelationLine line) throws ModelException
entity - the entityline - the source lineModelException - if parsing the model failedpublic Entity getEntity()
Relationpublic List<String> getAnnotations()
RelationgetAnnotations in interface Relationpublic String getGetterSetterComment()
RelationgetGetterSetterComment in interface Relationpublic void validate()
throws ModelException
Relationvalidate in interface RelationModelException - if validation failedpublic String getName()
getName in interface ModelElementpublic void setName(String name)
public RelationLine getSourceLine()
public void setSourceLine(RelationLine sourceLine)
sourceLine - the linepublic ModelException createModelException(String message)
Refers to the source line if set, otherwise just the message.
message - the messagepublic String getComment()
RelationgetComment in interface Relationpublic String getClassName()
RelationgetClassName in interface Relationpublic RelationType getRelationType()
RelationgetRelationType in interface Relationpublic AccessScope getAccessScope()
RelationgetAccessScope in interface Relationpublic Attribute getAttribute()
RelationgetAttribute in interface Relationpublic Entity getForeignEntity()
RelationgetForeignEntity in interface Relationpublic Attribute getForeignAttribute()
RelationgetForeignAttribute in interface Relationpublic Relation getForeignRelation()
RelationgetForeignRelation in interface Relationpublic Relation getNmRelation()
RelationgetNmRelation in interface Relationpublic Relation getDefiningNmRelation()
RelationgetDefiningNmRelation in interface Relationpublic boolean isComposite()
RelationisComposite in interface Relationpublic boolean isTracked()
Relationpublic boolean isReferenced()
RelationisReferenced in interface Relationpublic boolean isProcessed()
RelationisProcessed in interface Relationpublic boolean isReadOnly()
RelationisReadOnly in interface Relationpublic boolean isWriteOnly()
RelationisWriteOnly in interface Relationpublic boolean isSerialized()
RelationisSerialized in interface Relationpublic boolean isClearOnRemoteSave()
RelationisClearOnRemoteSave in interface Relationpublic boolean isReversed()
RelationisReversed in interface Relationpublic Attribute getCountAttribute()
RelationgetCountAttribute in interface Relationpublic String getMethodName()
RelationgetMethodName in interface Relationpublic List<MethodArgument> getMethodArgs()
RelationgetMethodArgs in interface Relationpublic String getNmName()
Relationpublic String getNmMethodName()
RelationRelation.getMethodName() but for nm relation.getNmMethodName in interface Relationpublic String getLinkMethodName()
RelationgetLinkMethodName in interface Relationpublic String getLinkMethodIndex()
RelationgetLinkMethodIndex in interface Relationpublic SelectionType getSelectionType()
RelationgetSelectionType in interface Relationpublic boolean isSelectionCached()
RelationisSelectionCached in interface Relationpublic String getSelectionWurbletArguments()
RelationgetSelectionWurbletArguments in interface Relationpublic boolean isDeletionFromMainClass()
RelationisDeletionFromMainClass in interface Relationpublic boolean isDeletionCascaded()
RelationisDeletionCascaded in interface Relationpublic void setNmRelation(Relation nmRelation)
public void setDefiningNmRelation(Relation definingNmRelation)
public void setAttribute(Attribute attribute)
public void setForeignEntity(Entity foreignEntity)
public void setForeignAttribute(Attribute foreignAttribute)
public void setForeignRelation(Relation foreignRelation)
public void setClassName(String className)
public void setComment(String comment)
public void setComposite(boolean composite)
public void setLinkMethodName(String linkMethodName)
public void setMethodArgs(List<MethodArgument> methodArgs)
public void setNmName(String nmName)
public void setNmMethodName(String nmMethodName)
public void setMethodName(String methodName)
public void setReadOnly(boolean readOnly)
public void setReferenced(boolean referenced)
public void setProcessed(boolean processed)
public void setRelationType(RelationType relationType)
public void setSerialized(boolean serialized)
public void setClearOnRemoteSave(boolean clearOnRemoteSave)
public void setReversed(boolean reversed)
public void setCountAttribute(Attribute countAttribute)
public void setTracked(boolean tracked)
public void setWriteOnly(boolean writeOnly)
public void setSelectionType(SelectionType selectionType)
public void setSelectionCached(boolean selectionCached)
public void setSelectionWurbletArguments(String selectionWurbletArguments)
public void setAccessScope(AccessScope accessScope)
public void setDeletionCascaded(boolean deletionCascaded)
public void setDeletionFromMainClass(boolean deletionFromMainClass)
public void setLinkMethodIndex(String linkMethodIndex)
public String getVariableName()
getVariableName in interface Relationpublic String getMethodNameSuffix()
Example:
"set" + getMethodNameSuffix() would return "setBlah" if the classname is "Blah" or the name is "blah".
getMethodNameSuffix in interface Relationpublic String getGetterName()
RelationgetGetterName in interface Relationpublic String getSetterName()
RelationgetSetterName in interface Relationpublic String getDeclaredJavaType(boolean withinForeignEntity)
RelationgetDeclaredJavaType in interface RelationwithinForeignEntity - true if we need the type from within the foreign entity,
else from within the relation's entitypublic String getJavaType()
RelationExample: the effective type is ArrayList and the declared type is List.
getJavaType in interface Relationpublic boolean isDeepReference()
RelationisDeepReference in interface Relationpublic void setDeepReference(boolean deepReference)
Tentackle - a domain driven enterprise framework