Generate Concept properties in java sources
I was trying to write a small application that uses Concept Properties (as well as Child Concept Properties declarations)
And it turned out that in generated java code these properties are not available. Could you add them to generated code, please?
Also it looks like MPS errorneously suggests (when Ctrl+Space is pressed) concept properties for concepts that dont have Child Concept Property declarations in superclasses and does not allow arbitary concept properties at all...
Please sign in to leave a comment.
Hi, I've submitted both requests to jira:
http://www.jetbrains.net/jira/browse/MPS-544
http://www.jetbrains.net/jira/browse/MPS-545
Meanwhile, try to use accessors from SModelUtil class:
+hasConceptProperty
getConceptProperty
getIntegerConceptProperty
getBooleanConceptProperty+
Regards, Igor.
Eh.. it's not clear what is IScope? can I pass null?
parameter SNode - is that the instance of the concept? I thought that the instance of the concept is not necessary to retvieve the concept property (similar to static members in java class: you dont have to have an instance of a class to access static members)..?
IScope can be obtained from operation context (IOperationContext), generator (ITemplateGenerator) or typechecker (ITypeChecker) - one of them is normally passed to query method as parameter.
Or you can use "global scope" as GlobalScope.getInstance().
SNode can be either concept (concept declaration) or instance of concept.
In the latter case, concept for that instance is obtained first. Then, the method performs look-up of concept property in given concept.
Not quite - to perform lookup of static field in java class you need instance of java.lang.Class. In our case you need instance of jetbrains.mps.bootstrap.structureLanguage.ConceptDeclaration.
Igor