Access to static java class fields and methods

25 views
Skip to first unread message

Oleg Barmin

unread,
Dec 4, 2018, 5:18:38 AM12/4/18
to Pebble Templating Engine
Hello,

I have the following enum

package org.towatch.routes;

public enum Sort {
BEST, POPULAR;
} 

So I want to test Sort values in my template in following way:
{% if sortVar == Sort.BEST %}
{% else %}
{% endif %}

But template not recognizes Sort as the class. How to access static java fields and methods from template?
The only way I found is
{% if sortVar == sortVar.BEST %}
{% else %}
{% endif %}
But this is not good code practice.

Reply all
Reply to author
Forward
0 new messages