Java Reference
In-Depth Information
This is the corresponding Xtend utility file dncUtil.ext :
import dnc;
import oocore;
String fullyQualifiedName(Package p) :
p.package == null ? p.name : fullyQualifiedName(p.package) + '.'
+ p.name
;
String fullyQualifiedName(Class c) :
let p = fullyQualifiedName(c.package) : p != '' &&
p != "java.lang" ? p + '.' + c.name : c.name
;
String fullyQualifiedName(Void v) : '';
String fullyQualifiedPath(Class c) :
fullyQualifiedName(c.package).replaceAll('\\.', '/') +
"/" + c.name + ".java"
;
String wrapIfCollection(Reference reference) :
reference.upperBound == -1 ?
"java.util.Collection" + "<" + fullyQualifiedName(reference.type) +
">" :
fullyQualifiedName(reference.type)
;
Boolean isValid(Package package) :
package != null && package.name.length > 0
;
String asColumnNameChar(String s) :
s.toLowerCase() == s ? s.toUpperCase() : '_' + s.toUpperCase()
;
Boolean isEntity(Class c) :
c.metaType == dnc::MomentInterval ||
c.metaType == dnc::MIDetail ||
c.metaType == dnc::Party ||
c.metaType == dnc::Place ||
c.metaType == dnc::Thing ||
c.metaType == dnc::Description
;
// Currently, we only create backward reference for ManyToOne
relationships
Boolean generateReference(oocore::Reference ref) :
ref.type.isEntity() && ref.opposite.metaType == dnc::Association &&
ref.opposite.upperBound == -1
;
Search WWH ::




Custom Search