| Summary: | [Xbase] Make embedding Xbase easier | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sven Efftinge <sven.efftinge> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | jan, sebastian.zarnekow |
| Version: | 2.1.0 | Flags: | sven.efftinge:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Sven Efftinge
With such a change the domain model language can be defined by using the grammar as is and *only* provide the following code (a JvmInferrer using a builder syntax):
class DomainmodelJvmModelInferrer extends AbstractModelInferrer {
@Inject extension JvmTypesBuilder
def dispatch infer(Entity e, IAcceptor<JvmDeclaredType> acceptor) {
acceptor.accept(
e.toClazz( e.name ) [
if (e.superType != null)
superTypes += e.superType.cloneWithProxies
for ( f : e.features ) {
switch f {
Property : {
members += f.toField(f.name, f.type)
members += f.toGetter(f.name, f.type)
members += f.toSetter(f.name, f.type)
}
Operation : {
members += f.toMethod(f.name, f.type) [
for (p : f.params) {
parameters.add(p.toParameter(p.name, p.parameterType))
}
]
}
}
}
]
)
}
}
The code might change a bit as we work on this ticket, but it should illustrate the idea and the improvement.
That would be awesome - looking forward to updating the tutorial ;-) the domain model example is now based on a new API which reuses the inferred JvmModel. Also PureXbase has been migrated. The generic Code regenerator as well as the builder API need to be further enhanced to support more of the JvmModel elements. Next step would be to make Xtend use the new approach. Xtend2 now uses the proposed approach. Still open: Resolve name collisions of JvmElements created from create extensions. Fixed duplicate names for create extensions. closing this one. Please open dedicated bugzillas per concrete issue. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |