Skip to content

Improvements to AffordanceModelFactory SPI #1441

@odrotbohm

Description

@odrotbohm

AffordanceModelFactory currently gets a list of parameters handed to create an AffordanceModel instance. Those instances are media type specific and contain customizations needed to render media type specific representations of the affordances. That design makes it hard to evolve that list as adding parameters breaks implementations immediately.

We should move to a different signature that takes a single contextual objects that we can potentially add new methods on. This would allow media type implementations to pick up the newly introduced features as they see fit.

interface AffordanceModelFactory {
  AffordanceModel getAffordanceModel(ConfiguredAffordance configured) { /* … */ }
}

In the first draft, ConfiguredAffordance would expose all properties needed by the currently available method so that we can introduce the method as a default one and delegate to the old signature. At the same time, the old signature method can be made a default one, too, so that we can move implementations that we control off that method already. The default implementation would throw an exception which is fine for now as existing implementations already implement the method.

ConfiguredAffordance will be introduced in combination with ConfigurableAffordance which both are implemented by current AffordanceBuilder. The latter will be deprecated in favor of the two interfaces to let clients that previously might have referred to AB in variable assignments.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions