Enum Comparisons in Thymeleaf

How can I do an Enum comparison in Thymeleaf?

--------------

To display a "View Source" link on the Post Permalink page for LINK Post Types only we check the Post.PostType property, which is an Enum. I sampled the following two approaches in the StackOverflow thread and went with the second because it was cleaner.

<div th:if="${post.postType == T(com.nixmash.blog.jpa.enums.PostType).LINK}">
           
<div th:if="${post.postType.name() == 'LINK'}">
Posted April 05, 2017 05:03 PM EDT

More Like This Post