question-circle How to query a specific PropertyTable instance on a model element

4 months 1 week ago #5435 by craae
How can you access the specific properties (and its values) related to an model element within a PropertyTable using Jython or alternatively Eclipse?

The "content placeholder" seems to concatenate all the properties and the associated values together in a string which makes it hard to use and operate.

Are you able to somehow fetch the specific PropertyTable by using any of the findBy... methods?

Attachments:

Please Log in or Create an account to join the conversation.

4 months 1 week ago #5436 by cma
Hello,

With Jython you may query a PropertyTable with these methods:
  • String getProperty(String key)
  • java.util.Properties toProperties() toProperties()

To modify a PropertyTable you may use:
  • setProperty(String key, String value)
  • setContent(java.util.Properties newprops)

Don't use String getContent() or setContent(String) .

Please Log in or Create an account to join the conversation.

4 months 1 week ago #5437 by craae
Thanks that works fine - But how would I have found those methods myself?

BTW the getProperty(String key) method doesn't allow key values with spaces. In that case it returns None as result.
Is it possible to have Property keys with spaces included, and still use the getProperty(String key) method?
BR
Claus

Please Log in or Create an account to join the conversation.

4 months 1 week ago #5440 by craae
As stated earlier the getProperty(string key) returns "None" if the key have one og more spaces included? How if the key internally represented? Are spaces removed or how do I query properties where the key (the property description have spaces included?)
BR
Claus

Please Log in or Create an account to join the conversation.

1 month 2 weeks ago #5534 by ebr
Dear Claus,

The key seems to be store with all spaces.

Concerning methods documentation, you have the JavaDoc here and the semantic view is also useful because if it shows a "Properties" relationship for example, youshould have an associatied "getProperties" method in the API.

Hoping it helps,
EBR

Please Log in or Create an account to join the conversation.

Moderators: chmcma
Time to create page: 0.135 seconds
^ Back to Top