public interface Alternatives<T extends GoloElement<?>>
This interface is mainly a fluent builder for a WhenClause
container.
Modifier and Type | Method and Description |
---|---|
java.util.List<WhenClause<T>> |
getClauses() |
T |
getOtherwise() |
Alternatives<T> |
otherwise(java.lang.Object action)
Defines the default alternative clause.
|
Alternatives<T> |
then(java.lang.Object action)
Defines the action of the previous clause.
|
Alternatives<T> |
when(java.lang.Object cond)
Defines a new alternative clause.
|
Alternatives<T> when(java.lang.Object cond)
This is a builder method.
cond
- an expression node defining the clause.Alternatives<T> then(java.lang.Object action)
This is a builder method.
It must be called after a call to when
. For instance
alternative.when(condition).then(action);
action
- the action to execute in this clause. Its type depends on the kind of alternative
(i.e. the WhenClause
constructed)Alternatives<T> otherwise(java.lang.Object action)
This is a builder method.
action
- the action to execute in this clause. Its type depends on the kind of alternative
(i.e. the WhenClause
constructed)java.util.List<WhenClause<T>> getClauses()
T getOtherwise()