布尔值

  • #bools: 用于布尔运算的实用方法。
  1. /*
  2. * ======================================================================
  3. * See javadoc API for class org.thymeleaf.expression.Bools
  4. * ======================================================================
  5. */
  6. /*
  7. * Evaluate a condition in the same way that it would be evaluated in a th:if tag
  8. * (see conditional evaluation chapter afterwards).
  9. * Also works with arrays, lists or sets
  10. */
  11. ${#bools.isTrue(obj)}
  12. ${#bools.arrayIsTrue(objArray)}
  13. ${#bools.listIsTrue(objList)}
  14. ${#bools.setIsTrue(objSet)}
  15. /*
  16. * Evaluate with negation
  17. * Also works with arrays, lists or sets
  18. */
  19. ${#bools.isFalse(cond)}
  20. ${#bools.arrayIsFalse(condArray)}
  21. ${#bools.listIsFalse(condList)}
  22. ${#bools.setIsFalse(condSet)}
  23. /*
  24. * Evaluate and apply AND operator
  25. * Receive an array, a list or a set as parameter
  26. */
  27. ${#bools.arrayAnd(condArray)}
  28. ${#bools.listAnd(condList)}
  29. ${#bools.setAnd(condSet)}
  30. /*
  31. * Evaluate and apply OR operator
  32. * Receive an array, a list or a set as parameter
  33. */
  34. ${#bools.arrayOr(condArray)}
  35. ${#bools.listOr(condList)}
  36. ${#bools.setOr(condSet)}