Skip to content

Commit

Permalink
Merge pull request #136 from domaframework/kotlin-destructuring
Browse files Browse the repository at this point in the history
更新結果を表すクラスで Kotlin の Destructuring Declarations に対応
  • Loading branch information
nakamura-to committed May 15, 2016
2 parents 3e23021 + 1a871f1 commit e4088db
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
28 changes: 26 additions & 2 deletions src/main/java/org/seasar/doma/jdbc/BatchResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,34 @@ public List<ENTITY> getEntities() {
return entities;
}

/**
* エンティティのリストを返します。
*
* @return エンティティのリスト
* @see <a
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
* Declarations</a>
*/
public List<ENTITY> component1() {
return entities;
}

/**
* 更新件数の配列を返します。
*
* @return 更新件数の配列
* @see <a
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
* Declarations</a>
*/
public int[] component2() {
return counts;
}

@Override
public String toString() {
return "BatchResult [counts=" + Arrays.toString(counts) + ", entities="
+ entities + "]";
return "BatchResult(entities=" + entities + ", counts="
+ Arrays.toString(counts) + ")";
}

}
26 changes: 25 additions & 1 deletion src/main/java/org/seasar/doma/jdbc/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,33 @@ public ENTITY getEntity() {
return entity;
}

/**
* エンティティを返します。
*
* @return エンティティ
* @see <a
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
* Declarations</a>
*/
public ENTITY component1() {
return entity;
}

/**
* 更新件数を返します。
*
* @return 更新件数
* @see <a
* href="https://kotlinlang.org/docs/reference/multi-declarations.html">Destructuring
* Declarations</a>
*/
public int component2() {
return count;
}

@Override
public String toString() {
return "Result [count=" + count + ", entity=" + entity + "]";
return "Result(entity=" + entity + ", count=" + count + ")";
}

}

0 comments on commit e4088db

Please sign in to comment.