-
Dear Quarkus community, does anybody know if and how it is possible in a Qute template to query a value from a Map when the key is an Enum? Example: package a.b.c;
public enum Test {
VAL1, VALS
}
var map = new HashMap<Test, String>(); In the Qute template neither At the moment I work around the issue by defining the HashMap as You help is apreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
/cc @mkouba |
Beta Was this translation helpful? Give feedback.
-
You can annotate your enum with |
Beta Was this translation helpful? Give feedback.
-
@mkouba thank you very much. It works. It is also in the docs. But, until you answer here I lacked the brain power to relate this to my issue. |
Beta Was this translation helpful? Give feedback.
You can annotate your enum with
@TemplateEnum
and use something likemap.get(Test:VAL1)
. If you don't control the source of the enum you'd need to implement a template extension method like this: https://github.com/quarkusio/quarkus/blob/main/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java#L110-L113.