1

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?

ronx
  • 89
  • 2
  • 7

1 Answers1

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

https://sling.apache.org/

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
  • 1
    I 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