|
|
|
|
|
|
|
|
|
Re: Enrich Xbase expression programatically in Inferrer [message #1715277 is a reply to message #1714363] |
Fri, 20 November 2015 19:35 |
Michael Vorburger Messages: 103 Registered: July 2009 |
Senior Member |
|
|
Hello, similar related problem and found this by chance... I'd like to generate something like:
private void updateField() {
this.someField = (...)
}
where the (...) is from an XExpression. Until https://bugs.eclipse.org/bugs/show_bug.cgi?id=481992 is available, I've attempted
members += property.toMethod("updateField", typeRef(void)) [
body = '''this.«property.name» = «property.formula»;'''
]
but that doesn't work, of course.. it gives a toString debug representation of the XExpression, not the "compiled" form. So, for now, I'm working around like this:
members += property.toMethod("updateField_", typeRef(String)) [
visibility = JvmVisibility.PRIVATE
body = property.formula
]
members += property.toMethod("updateField_, typeRef(void)) [
visibility = JvmVisibility.PRIVATE
body = '''this.«property.name» = «property.name»_();'''
]
which generates something like this.. works, but a big ugly, any suggestions how this could be made neater?
private String updateField_() {
(...)
}
private void updateField() {
this.someField = updateField_();
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03355 seconds