I've seen conventions in Java pojos that use can, has, and should instead of the usual is. However, in AEM 6.1 we have WCMUsePojo
right? is works for sure, and I've tried has but hasn't worked. Is this a bug or WCMUsePojo
never really intended other getter prefixes for booleans other than is?
Asked
Active
Viewed 276 times
1

ronx
- 89
- 2
- 7
-
afaik sightly compiler supports only "is" and "get" prefixes. – awd Jul 05 '18 at 12:07
-
3However, you can call the full method name. Say your method is ‘hasTitle’, in your HTL expression you can use ‘hasTitle’ – Ahmed Musallam Jul 05 '18 at 19:04
1 Answers
3
No.
The Use
api looks at a Pojo from the perspective of a Java Bean.
http://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/
For boolean values the convention is that the value be prefixed with an 'is' or a 'get' prefix. Using the prefix "has" has never been a part of the JavaBean specification. However that doesn't mean that the Use API shouldn't do that. Contextually "has" makes more sense sometimes. So you may be able to open a request or inquire about having that added to the api support. The maintainers of HTL are the committers to the Apache Sling project
And if you are interested the source code for HTL is here https://github.com/apache/sling-org-apache-sling-scripting-sightly

JE Bailey
- 727
- 7
- 25
-
1I see. I assumed that the other prefixes were part of the standard. Apparently, it _is_ just 'is' and nothing else. That might be a good suggestion for the HTL team. Thank you for clarifying!! – ronx Jul 08 '18 at 13:06