https://github.com/thymeleaf/thymeleaf/issues/112#issuecomment-193490091#496
https://github.com/thymeleaf/thymeleaf/issues/112#issuecomment-193490091#496sukhokri wants to merge 1 commit intothymeleaf:3.0-devfrom
Conversation
commit: added Switch Case expression and its helping classes
| public final class Case implements Serializable { | ||
|
|
||
|
|
||
| /** |
| private final IStandardExpression caseExprValue; | ||
|
|
||
| Case(final IStandardExpression caseExpr, final IStandardExpression caseExprValue) { | ||
| super(); |
There was a problem hiding this comment.
super is called automatically so it can be removed
| private final List<Case> cases; | ||
|
|
||
| CaseSequence(final List<Case> cases) { | ||
| super(); |
There was a problem hiding this comment.
super() can be removed since it's called automatically
| public class CaseSequence implements Iterable<Case>, Serializable { | ||
|
|
||
|
|
||
| /** |
There was a problem hiding this comment.
remove empty documentation since it doesn't add value
| final String switchStr = input.substring(0, operatorPos).trim(); | ||
| final String remainder = input.substring(operatorPos + 1).trim(); | ||
|
|
||
| // Check the switch condition and fail quickly if it is not valid |
There was a problem hiding this comment.
this comment is useless as the code speaks for itself :)
| return null; | ||
| } | ||
|
|
||
| // Trying to fail quickly... |
There was a problem hiding this comment.
this comment is useless as the code speaks for itself :)
| Object defaultCase = null; | ||
|
|
||
| // compare each case 'key' with switch variable | ||
| // if the switch variable matches on of the cases, return its value |
There was a problem hiding this comment.
this comment is useless as the code speaks for itself :)
There was a problem hiding this comment.
@vborcea you are obviously free to comment on any code on GitHub, but I'd appreciate if you please don't use that kind of language.
There was a problem hiding this comment.
@danielfernandez Sorry, I didn't wanted to harm no one. :). What I wanted to say was that the code speaks for itself so adding extra comment on a nice written code is useless. I didn't wanted to be a jerk at all.
| /* | ||
| * ============================================================================= | ||
| * | ||
| * Copyright (c) 2011-2016, The THYMELEAF team (http://www.thymeleaf.org) |
| /* | ||
| * ============================================================================= | ||
| * | ||
| * Copyright (c) 2011-2016, The THYMELEAF team (http://www.thymeleaf.org) |
| /* | ||
| * ============================================================================= | ||
| * | ||
| * Copyright (c) 2011-2016, The THYMELEAF team (http://www.thymeleaf.org) |
| // remainder string should represent the case sequence | ||
| // condition: at least 1 case should exist | ||
|
|
||
| CaseSequence sequence = CaseUtils.composeSequence(remainder); |
commit: added Switch Case expression and its helping classes