https://github.com/vsimko/xmf
Xtend-centric meta-model specification
https://github.com/vsimko/xmf
Last synced: 4 months ago
JSON representation
Xtend-centric meta-model specification
- Host: GitHub
- URL: https://github.com/vsimko/xmf
- Owner: vsimko
- License: mit
- Created: 2015-01-21T01:37:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-24T23:18:22.000Z (over 11 years ago)
- Last Synced: 2025-01-11T16:18:09.553Z (over 1 year ago)
- Language: Xtend
- Size: 531 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XMF: Xtend-centric meta-model specification
Using Xtend active annotations, the following code is converted automagically into a EMF-based meta-model and API.
- aimed at programmers who are familiar with EMF
- API is generated automatically while the programer writes code in the editor
- no *.genmodel files required
- no *.ecore files required
- just plain Xtend
This project is currently just a proof-of-concept.
It only covers a very small portion of EMF.
## Currently supported:
- `@XMFPackage` creates `EPackage` + `EFactory` classes
- `@XMF` for classes of the meta model
- inheritance using classes and abstract classes (currently no interfaces, but it will change soon)
- `@Contained` for containment relation
- `@Invariant` marks validation methods. XMF will automatically create the Validator class as necessary
- Non-XMF datatypes are treated as attributes
- XMF datatype is treated as a reference
- `@DerivedAttribute` for attributes whose value is computed in a method
- `List` is treated as a attribute/reference of cardinality `0..*` and mapped to `EList`
- public methods are treated as `EOperations`
- non-public method are ignored
## Example meta model:
```Xtend
@XMFPackage("http://some/eNS_URI")
@XMF abstract class NamedEntity {
@ID String name
@Invariant("name must be smaller than 10 characters")
def nameSizeConstraint() {
name.length < 10
}
@Invariant("name cannot be empty")
def nameNotEmpty() {
! name.empty
}
}
@XMF class User extends NamedEntity {
List phones
@OppositeOf("users") Group group
@Contained Account userAccount
def someOperation() {
...
}
private def helperMethod() {
...
}
}
@XMF class Group extends NamedEntity {
@Contained List users
@DerivedAttribute def paidUsers() {
users.filter[salary > 0]
}
}
@XMF class Account {
int salary = 0
}
```