Skip to content

Commit e4088db

Browse files
committed
Merge pull request #136 from domaframework/kotlin-destructuring
更新結果を表すクラスで Kotlin の Destructuring Declarations に対応
2 parents 3e23021 + 1a871f1 commit e4088db

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

src/main/java/org/seasar/doma/jdbc/BatchResult.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,34 @@ public List<ENTITY> getEntities() {
6363
return entities;
6464
}
6565

66+
/**
67+
* エンティティのリストを返します。
68+
*
69+
* @return エンティティのリスト
70+
* @see <a
71+
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
72+
* Declarations</a>
73+
*/
74+
public List<ENTITY> component1() {
75+
return entities;
76+
}
77+
78+
/**
79+
* 更新件数の配列を返します。
80+
*
81+
* @return 更新件数の配列
82+
* @see <a
83+
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
84+
* Declarations</a>
85+
*/
86+
public int[] component2() {
87+
return counts;
88+
}
89+
6690
@Override
6791
public String toString() {
68-
return "BatchResult [counts=" + Arrays.toString(counts) + ", entities="
69-
+ entities + "]";
92+
return "BatchResult(entities=" + entities + ", counts="
93+
+ Arrays.toString(counts) + ")";
7094
}
7195

7296
}

src/main/java/org/seasar/doma/jdbc/Result.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,33 @@ public ENTITY getEntity() {
6060
return entity;
6161
}
6262

63+
/**
64+
* エンティティを返します。
65+
*
66+
* @return エンティティ
67+
* @see <a
68+
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
69+
* Declarations</a>
70+
*/
71+
public ENTITY component1() {
72+
return entity;
73+
}
74+
75+
/**
76+
* 更新件数を返します。
77+
*
78+
* @return 更新件数
79+
* @see <a
80+
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
81+
* Declarations</a>
82+
*/
83+
public int component2() {
84+
return count;
85+
}
86+
6387
@Override
6488
public String toString() {
65-
return "Result [count=" + count + ", entity=" + entity + "]";
89+
return "Result(entity=" + entity + ", count=" + count + ")";
6690
}
6791

6892
}

0 commit comments

Comments
 (0)