[BLOSSOM-232] Annotations for declaring template parameters Created: 15/Apr/16  Updated: 29/Apr/16  Resolved: 29/Apr/16

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.3

Type: Improvement Priority: Neutral
Reporter: Tobias Mattsson Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to BLOSSOM-236 Add @Repeatable on @TemplateParam whe... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

Right now template parameters can be set using a post create callback. For completeness it would be nice if these could be declared using annotations along with other template settings. Since parameters are defined on the RenderableDefinition interface this annotation should be usable on @Area too.

The annotation is a candidate for a repeatable annotation as introduced in Java 8. Magnolia is currently on Java 7 so the annotation should be designed so that it can be used as a repeatable annotation once Magnolia goes to Java 8.
https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html

In a class hierarchy the annotations should be evaluated from top to bottom (superclass first) so that a subclass can override parameters in its superclass.

The post create callback style that's necessary now:

@PreRegister
public void preRegister(ConfiguredTemplateDefinition definition) {
    Map<String, Object> params = new HashMap<>();
    params.put("name", "value");
    definition.setParameters(params);
}

Generated at Sun Feb 11 23:31:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.