org.thymeleaf.standard.processor.attr
Class StandardSwitchAttrProcessor

Object
  extended by org.thymeleaf.processor.AbstractProcessor
      extended by org.thymeleaf.processor.attr.AbstractAttrProcessor
          extended by org.thymeleaf.processor.attr.AbstractLocalVariableDefinitionAttrProcessor
              extended by org.thymeleaf.standard.processor.attr.AbstractStandardSwitchStructureAttrProcessor
                  extended by org.thymeleaf.standard.processor.attr.StandardSwitchAttrProcessor
All Implemented Interfaces:
Comparable<IProcessor>, IProcessor

public final class StandardSwitchAttrProcessor
extends AbstractStandardSwitchStructureAttrProcessor

Selects a child element for rendering if the child's th:case expression is an exact match of this processor's expression, eg:

<div th:switch="${user.role}">
  <p th:case="'admin'">User is an administrator</p>
  <p th:case="#{roles.manager}">User is a manager</p>
</div>

Note that as soon as one th:case attribute is evaluated as true, every other th:case attribute in the same switch context is evaluated as false.

The default option is specified as th:case="*"

Since:
2.0.0
Author:
Daniel Fernández

Nested Class Summary
 
Nested classes/interfaces inherited from class org.thymeleaf.standard.processor.attr.AbstractStandardSwitchStructureAttrProcessor
AbstractStandardSwitchStructureAttrProcessor.SwitchStructure
 
Field Summary
static String ATTR_NAME
           
static int ATTR_PRECEDENCE
           
 
Fields inherited from class org.thymeleaf.standard.processor.attr.AbstractStandardSwitchStructureAttrProcessor
SWITCH_VARIABLE_NAME
 
Constructor Summary
StandardSwitchAttrProcessor()
           
 
Method Summary
 int getPrecedence()
           
 
Methods inherited from class org.thymeleaf.standard.processor.attr.AbstractStandardSwitchStructureAttrProcessor
getNewLocalVariables
 
Methods inherited from class org.thymeleaf.processor.attr.AbstractLocalVariableDefinitionAttrProcessor
processAttribute
 
Methods inherited from class org.thymeleaf.processor.attr.AbstractAttrProcessor
doProcess, getMatcher
 
Methods inherited from class org.thymeleaf.processor.AbstractProcessor
compareTo, getMessage, getMessageForProcessor, getMessageForTemplate, process
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_PRECEDENCE

public static final int ATTR_PRECEDENCE
See Also:
Constant Field Values

ATTR_NAME

public static final String ATTR_NAME
See Also:
Constant Field Values
Constructor Detail

StandardSwitchAttrProcessor

public StandardSwitchAttrProcessor()
Method Detail

getPrecedence

public int getPrecedence()
Specified by:
getPrecedence in class AbstractProcessor


Copyright © 2013 The THYMELEAF team. All Rights Reserved.