EXPERIMENTALな位置づけです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Era { | |
@Id | |
public Integer id; | |
public String name; | |
public Interval interval; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Embeddable | |
data class Address(val city: String, val street: String) | |
@Entity(immutable = true) | |
data class Person(@Id val id: Int, val name: String, val address: Address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Embeddable | |
public class Address { | |
private final String city; | |
private final String street; | |
public Address(String city, String street) { | |
this.city = city; | |
this.street = street; | |
} | |
public String getCity() { | |
return city; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tutorial.entity; | |
import org.seasar.doma.Entity; | |
@Entity(listener = CommonListener.class) | |
public abstract class Common { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class ChildEntity extends ParentEntity { | |
Integer ccc; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ブロック付きメソッドのファクトリ | |
*/ | |
function ruby(fn) { | |
return run; | |
function run(block) { | |
var block_given = typeof block === 'function'; | |
var each = function * (array) { | |
for (var i = 0, len = array.length ; i < len; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* IoC (Inversion o Control) Computation Expression | |
*/ | |
function ioc(fn) { | |
assert(isGeneratorFunction(fn), 'The argument `fn` must be a GeneratorFunction.'); | |
run.mflow_generatorFunction = fn; | |
return run; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var maybe = { | |
'return': function (value) { | |
return value; | |
}, | |
'bind': function (value, f) { | |
if (value == null) return null; | |
return f(value); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Douglas CrockfordのMaybeモナド | |
// | |
// http://www.youtube.com/watch?v=b0EF0VTs9Dc | |
// 上記のyoutubeより(時間にして21:50, 26:50, 27:15のコード) | |
function MONAD(modifier) { | |
var prototype = Object.create(null); | |
return function unit(value) { | |
var monad = Object.create(prototype); | |
monad.bind = function (func, args) { |