Java Reference
In-Depth Information
end
{
if
(
not self
.opposite.
oclIsUndefined
()
and
self
.opposite.owner.isEntity())
then
{
if
(
self
.upperBound = 1
and
(
self
.opposite.upperBound = 1
or self
.opposite.upperBound = 0))
then
{
result
.eAnnotations +=
toAnnotation('annotation', '@OneToOne(targetEntity=' +
self
.opposite.owner.fullyQualifiedName() + '.class)',
null
);
class.classImport +=
'javax.persistence.OneToOne'.
map
toClass();
}
endif
;
if
(
self
.upperBound = -1
and
(
self
.opposite.upperBound = 1
or self
.opposite.upperBound = 0))
then
{
result
.eAnnotations +=
toAnnotation('annotation', '@OneToMany(mappedBy="' +
self
.owner.name.toLowerCase() + 'Id")',
null
);
result
.eAnnotations +=
toAnnotation('collection', 'type', 'java.util.Collection');
class.classImport +=
'javax.persistence.OneToMany'.
map
toClass();
}
endif
;
var
columnName :
String
:=
null
;
if self
.name.toLowerCase() <>
self
.name
then
{
columnName :=
self
.name.toColumnName();
result
.eAnnotations += toAnnotation('annotation',
'@Column(name="' + columnName + '")',
null
)
}
endif
;
}
endif
;
class.methods +=
self
.
map
toGetter();
class.methods +=
self
.
map
toSetter();
}
}
/**
* Creates reference/getter/setter from opposite reference
* with annotations
*/
mapping
oocore::Reference::toReference(
inout
class : java::JavaClass) :
ecore::EReference
when
{
not self
.opposite.
oclIsUndefined
()
and
self
.opposite.owner.isEntity()
and self
.opposite.upperBound = -1
} {
name :=
self
.name;
eType :=
self
.type.
oclAsType
(dnc::Archetype).
late
resolveone
(java::JavaClass);
lowerBound :=
self
.lowerBound;
upperBound :=
self
.upperBound;
end
{
if self
.opposite.upperBound = -1
then
{
result
.eAnnotations +=
Search WWH ::
Custom Search