Skip to content

Commit 538d84c

Browse files
committed
Adding Tription JavaDoc
1 parent 82cb738 commit 538d84c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main/scala/spray/json/Tription.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
package spray.json
22

33
/**
4+
* A Triple-Option
5+
*
6+
* JavaScript (and JSON), unlike Java/Scala, allow undefined values, which are distinct from null values.
7+
* For example, a PUT request may have a payload like this:
8+
* <code>
9+
* { "id":"234565434567898789098765",
10+
* "field1": 7,
11+
* "field3: null,
12+
* "field4": undefined }
13+
* </code>
14+
* which would tell the server to update field1 to 7, set field3 to null, and leave field2 and field4 alone.
15+
* With a standard scala `Option`, it is impossible to tell whether the payload of the request had field2, field3,
16+
* and field4 null or undefined since any missing values translate to `None`.
17+
*
18+
* The Tription solves that problem by defining `Value` for present values, `Null` for null values, and
19+
* `Undefined` for values which are missing or explicitly marked as undefined.
20+
*
421
* Created by bathalh on 2/19/16.
522
*/
623
abstract class Tription[+T]

0 commit comments

Comments
 (0)