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...

0
4 comments

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.

0
Avatar
Permanently deleted user

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)..?

0

Eh.. it's not clear what is IScope? can I pass null?

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().

0

parameter SNode - is that the instance of the

concept?

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.

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)..?

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

0

Please sign in to leave a comment.