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
import java.time.LocalDate | |
//Domain entity, command an result from CQRS | |
data class Person(val id: Int, val name: String, val createdAt: LocalDate, val updateAt: LocalDate) | |
data class PersonCommand(val name: String) | |
data class PersonResult(val id: Int, val name: String) | |
//Repository, Logger and Mapper abstractions | |
interface Repository<T> { fun insert(entity: T) : T } |
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
import java.security.InvalidParameterException | |
import java.util.regex.Matcher | |
import java.util.regex.Pattern | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
//Domain entities with E-mail property | |
class Client(email: String) { | |
val email: String by EmailDelegated(email) | |
} |
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
import java.time.LocalDateTime | |
import java.util.UUID.randomUUID | |
abstract class EntityBase { | |
lateinit var id: String | |
lateinit var createAt: LocalDateTime | |
lateinit var lastUpdateAt: LocalDateTime | |
} | |
class Person(val name: String) : EntityBase() |
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
import com.google.gson.GsonBuilder | |
import kotlin.reflect.KMutableProperty | |
import kotlin.reflect.full.memberProperties | |
//Enum and properties to better infix semantic | |
private const val Terminal = 0 | |
enum class LogTarget(val value: Int) { | |
TERMINAL(0); |
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
// Colleague only exposes Notify method | |
// SetMediator and HandleNotification are private and protected to simplify client interface | |
// Not public methods are invoked using reflection. | |
public abstract class Colleague | |
{ | |
private IMediator _mediator; | |
protected void SetMediator(IMediator mediator) |