この文書は、今後 Doma 2 を開発していくにあたり、新規追加する機能について作者の考えを述べたものです。
- Doma は Annotation Processing Tool (apt) を利用した Java の Dao フレームワークである
- Doma 1 を Java 6 で開発してきたが、Java 8 への対応に伴い Doma 2 へメジャーバージョンアップする
- サポートする Java のバージョンは 8 以上とする
// 下記の記事の最後のコード例をKotlinで書いてみた | |
// https://zenn.dev/hinastory/articles/c8d5267ea43ed6 | |
package hello.kotlin | |
data class Person(val name: String, val age: Int) | |
data class Japanese(val name: String, val age: Int, val info: String) | |
interface CanGreet<T> { | |
fun T.hello() |
using System; | |
using System.Collections.Generic; | |
using System.Dynamic; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
using System.Data; | |
namespace DbConsole | |
{ | |
public class Db |
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); |
val d = Dept.meta | |
val e = Emp.meta | |
val query = SqlDsl.from(d).innerJoin(e){ d.id eq e.deptId }.associate(d, e) | |
val aggregate = db.runQuery { query } | |
val map: Map<Dept, Set<Emp>> = aggregate.oneToMany(d, e) |
public class Address { | |
public String ctiy; | |
public String street; | |
public Address(String city, String street) { | |
this.city = ctiy; | |
this.street = street; | |
} | |
} |
fun String.globalExtension() { | |
println(this) | |
} | |
class Scope { | |
fun String.narrowExtension() { | |
println(this) | |
} | |
} |
package org.komapper.quickstart | |
import org.komapper.annotation.KomapperAutoIncrement | |
import org.komapper.annotation.KomapperEntity | |
import org.komapper.annotation.KomapperId | |
import org.komapper.core.dsl.EntityDsl | |
import org.komapper.core.dsl.SchemaDsl | |
import org.komapper.core.dsl.expression.ColumnExpression | |
import org.komapper.core.dsl.scope.WhereDeclaration | |
import org.komapper.jdbc.JdbcDatabase |
package example; | |
import org.apache.commons.beanutils.expression.DefaultResolver; | |
public class SafeResolver extends DefaultResolver { | |
@Override | |
public String next(String expression) { | |
String property = super.next(expression); | |
if ("class".equalsIgnoreCase(property)) { |