Java Reference
In-Depth Information
}
else
{
parentPkg.eSubpackages += pkg;
parentPkg := pkg;
}
endif
;
};
}
name :=
self
.substring(
self
.lastIndexOf('.')+2,
self
.size());
eAnnotations += toAnnotation('library',
null
,
null
);
end
{
parentPkg.eClassifiers +=
result
;
}
}
/**
* Creates library class from Java type
*/
mapping
oocore::Classifier::toClass() : java::JavaClass {
name :=
self
.name;
-- Datatypes are marked as 'library'
eAnnotations += toAnnotation('library',
null
,
null
);
end
{
var
pack : java::JavaPackage :=
self
._package.
map
toPackage(
null
);
pack.eClassifiers +=
result
;
}
}
/**
* Creates JavaPackage from String
*/
mapping String
::toPackage() : java::JavaPackage {
name :=
self
;
}
/**
* Creates JavaPackage and adds passed child
*/
mapping
oocore::Package::toPackage(child : java::JavaPackage) :
java::JavaPackage {
init
{
result
:=
self
.name.
map
toPackage();
result
.eSubpackages += child;
if self
._package <>
null then
self
._package.
map
toPackage(
result
)
endif
;
}
}
/**
* Creates ECore annotation for use by template
*/
query
toAnnotation(type:
String
, key:
String
, value:
String
) :
ecore::EAnnotation {
return object
ecore::EAnnotation {
source := type;
details +=
object
ecore::EStringToStringMapEntry {
key := key;
Search WWH ::
Custom Search