Skip to content

Commit 9e3ffbe

Browse files
committed
Add document
1 parent 394f05d commit 9e3ffbe

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/domain.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ The value ``new`` means that the object of annotated class is created with a con
5959
6060
.. _records: https://openjdk.java.net/jeps/359
6161

62+
.. warning::
63+
64+
To annotate records with ``@Domain`` is a little redundant,
65+
because you must specify some properties to ``@Domain`` such as ``valueType``.
66+
Instead of ``@Domain``, you can annotate records with ``@DataType``:
67+
68+
.. code-block:: java
69+
70+
@DataType
71+
public record PhoneNumber(String value) {
72+
public String getAreaCode() {
73+
...
74+
}
75+
}
76+
77+
But note that ``@DataType`` is an experimental feature.
78+
6279

6380
Instantiation with a static factory method
6481
------------------------------------------

0 commit comments

Comments
 (0)