File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
src/main/java/org/seasar/doma Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,21 @@ The value ``new`` means that the object of annotated class is created with a con
4545 }
4646 }
4747
48+ .. note ::
49+ In Java 14 and later version, you can annotate `records `_ with ``@Domain ``:
50+
51+ .. code-block :: java
52+
53+ @Domain (valueType = String . class, accessorMethod = " value" )
54+ public record PhoneNumber(String value) {
55+ public String getAreaCode() {
56+ ...
57+ }
58+ }
59+
60+ .. _records : https://openjdk.java.net/jeps/359
61+
62+
4863Instantiation with a static factory method
4964------------------------------------------
5065
Original file line number Diff line number Diff line change @@ -60,6 +60,19 @@ The above entity definition is equivalent to following one:
6060 String zip;
6161 }
6262
63+ .. note ::
64+ In Java 14 and later version, you can annotate `records `_ with ``@Embeddable ``:
65+
66+ .. code-block :: java
67+
68+ @Embeddable
69+ public record Address(
70+ String city,
71+ String street,
72+ @Column (name = " ZIP_CODE" )String zip) {
73+ }
74+
75+ .. _records : https://openjdk.java.net/jeps/359
6376
6477Naming convention
6578-----------------
Original file line number Diff line number Diff line change @@ -30,6 +30,19 @@ The following code snippet shows how to inherit other entity class:
3030 ...
3131 }
3232
33+ .. note ::
34+ In Java 14 and later version, you can annotate `records `_ with ``@Entity ``:
35+
36+ .. code-block :: java
37+
38+ @Entity
39+ public record Employee(... ) {
40+ }
41+
42+ In the case, the entity is recognize as :ref: `immutable `
43+ even though the immutable property of ``@Entity `` is ``false ``.
44+
45+ .. _records : https://openjdk.java.net/jeps/359
3346
3447Entity listeners
3548---------------------------
@@ -77,6 +90,8 @@ the naming convention is ignored.
7790
7891An entity subclass inherits parent's naming convention.
7992
93+ .. _immutable :
94+
8095Immutable
8196----------------------------
8297
Original file line number Diff line number Diff line change 105105 * <p>If not specified and the entity class inherits another entity class, this value is inherited
106106 * from the parent entity class. The values must be consistent in the hierarchy.
107107 *
108+ * <p>If not specified and the entity class is a record, the class is recognized as immutable even
109+ * though this value is {@code false}.
110+ *
108111 * @return whether the entity class is immutable
109112 */
110113 boolean immutable () default false ;
You can’t perform that action at this time.
0 commit comments