1

When expanding an earlier answer I realized I don't know if it is possible to access a module-defined property from Java code. For example, if I have:

<define-property name="formfactor" values="desktop,tablet,mobile" />

Is something available in the SDK to go like this?

String ff = [someClass].getProperty("formfactor")`?
Community
  • 1
  • 1
Boris Brudnoy
  • 2,405
  • 18
  • 28

1 Answers1

2

You have to use deferred-binding.

The easiest way is to use <replace-with> rules, but it requires quite a lot of boilerplate code (one per value, with classes that return the same value as the property from a getter)

Or you could use a generator and <generate-with> rule.

In any case, you'll need an interface or base class to use in your code and whose exact implementation (either hand-coded or generated) will be switched using deferred binding rules.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164