You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _versions/main/guides/qute-reference.adoc
+39-16Lines changed: 39 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -774,11 +774,11 @@ A loop section may also define the `{#else}` block that is executed when there a
774
774
[[if_section]]
775
775
==== If Section
776
776
777
-
The `if` section represents a basic control flow section.
777
+
The `{#if}` section represents a basic control flow section.
778
778
The simplest possible version accepts a single parameter and renders the content if the condition is evaluated to `true`.
779
779
A condition without an operator evaluates to `true` if the value is not considered `falsy`, i.e. if the value is not `null`, `false`, an empty collection, an empty map, an empty array, an empty string/char sequence or a number equal to zero.
780
780
781
-
[source]
781
+
[source,html]
782
782
----
783
783
{#if item.active}
784
784
This item is active.
@@ -788,68 +788,91 @@ A condition without an operator evaluates to `true` if the value is not consider
788
788
You can also use the following operators in a condition:
|Evaluates to `true` if `value1` is greater than `value2`.
800
804
801
805
|greater than or equal to
802
806
|`ge`, `>=`
803
807
| 3
808
+
|`{#if item.price >= 100}This item is expensive.{/if}`
809
+
|Evaluates to `true` if `value1` is greater than or equal to `value2`.
804
810
805
811
|less than
806
812
|`lt`, `<`
807
813
| 3
814
+
|`{#if item.price < 100}This item is cheap.{/if}`
815
+
|Evaluates to `true` if `value1` is less than `value2`.
808
816
809
817
|less than or equal to
810
818
|`le`, `\<=`
811
819
| 3
820
+
|`{#if item.age <= 43}This item is young.{/if}`
821
+
|Evaluates to `true` if `value1` is less than or equal to `value2`.
812
822
813
823
|equals
814
824
|`eq`, `==`, `is`
815
825
| 2
826
+
|`{#if item.name eq 'Foo'}Foo item!{/if}`
827
+
|Evaluates to `true` if `value1` is equal to `value2`.
816
828
817
829
|not equals
818
830
|`ne`, `!=`
819
831
| 2
832
+
|`{#if item.name != 'Bar'}Not a Bar item!{/if}`
833
+
|Evaluates to `true` if `value1` is not equal to `value2`.
820
834
821
835
|logical AND (short-circuiting)
822
836
|`&&`, `and`
823
837
| 1
838
+
|`{#if item.price > 100 && item.isActive}Expensive and active item.{/if}`
839
+
|Evaluates to `true` if both operands evaluate to `true`.
824
840
825
841
|logical OR (short-circuiting)
826
842
|`\|\|`, `or`
827
843
| 1
844
+
|`{#if item.price > 100 \|\| item.isActive}Expensive or active item.{/if}`
845
+
|Evaluates to `true` if one of the operands evaluates to `true`.
828
846
829
847
|===
830
848
831
-
.A simple operator example
832
-
[source]
833
-
----
834
-
{#if item.age > 10}
835
-
This item is very old.
836
-
{/if}
837
-
----
849
+
For `>`, `>=`, `<`, and `\<=` the following rules are applied:
850
+
851
+
* Neither of the operands may be `null`.
852
+
* If both operands are of the same type that implements the `java.lang.Comparable` then the `Comparable#compareTo(T)` method is used to perform comparison.
853
+
* Otherwise, both operands are coerced to `java.math.BigDecimal` first and then the `BigDecimal#compareTo(BigDecimal)` method is used to perform comparison.
854
+
855
+
NOTE: Types that support coercion include `BigInteger`, `Integer`, `Long`, `Double`, `Float` and `String`.
856
+
857
+
For `==` and `!=` the following rules are applied:
858
+
859
+
* Operands are first tested using the `java.util.Objects#equals(Object, Object)` method. If it returns `true` the operands are considered equal.
860
+
* Otherwise, if both operands are not `null` and at least one of them is an instance of `java.lang.Number`, then operands are coerced to `java.math.BigDecimal` and the `BigDecimal#compareTo(BigDecimal)` method is used to perform comparison.
838
861
839
862
Multiple conditions are also supported.
840
863
841
864
.Multiple conditions example
842
-
[source]
865
+
[source,html]
843
866
----
844
867
{#if item.age > 10 && item.price > 500}
845
868
This item is very old and expensive.
846
869
{/if}
847
870
----
848
871
849
-
Precedence rules can be overridden by parentheses.
872
+
The default precedence rules (higher precedence wins) can be overridden by parentheses.
Copy file name to clipboardExpand all lines: _versions/main/guides/websockets-next-tutorial.adoc
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,6 @@ include::_attributes.adoc[]
10
10
:summary: This guide explains how your Quarkus application can utilize web sockets to create interactive web applications. This guide uses the WebSockets Next extension
11
11
:topics: web,websockets
12
12
:extensions: io.quarkus:quarkus-websockets-next
13
-
:extension-status: experimental
14
13
15
14
This guide explains how your Quarkus application can utilize web sockets to create interactive web applications.
16
15
In this guide, we will develop a very simple chat application using web sockets to receive and send messages to the other connected users.
0 commit comments