├── cargo
│ ├── Cargo.java
│ ├── CargoRepository.java
│ ├── Delivery.java
│ ├── HandlingActivity.java
│ ├── Itinerary.java
│ ├── Leg.java
│ ├── RouteSpecification.java
│ ├── RoutingStatus.java
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
class ApiServer extends HttpApp { | |
protected val design: Design = bind[Design] // ApiServerの外部で定義されているDesginを参照したい | |
.bind[AtomicReference[ActorSystem]] | |
.toInstance(systemReference) | |
.bind[ActorSystem] | |
.toInstanceProvider[AtomicReference[ActorSystem]](_.get) | |
// snip | |
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 point | |
import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
import point.MainActor.Start | |
import point.Point.{Distance, DistanceResult} | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ | |
object MainActor { |
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
case class Room(id: Long, members: Seq[Member]) | |
// このロジックはRoomが持つべき振る舞いだった場合(ドメインロジックがドメインオブジェクトの外側にある状態) | |
room.copy(members = room.members :+ newMember) | |
// ほんとは、こうしたらよいのでは | |
case class Room(id: Long, members: Seq[Member]) { | |
def addMember(value: Member): Room = | |
copy(members = this.members :+ value) | |
} | |
room.addMember(newMember) |
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 app | |
import cats.free._ | |
import cats._ | |
class DDD[ID, E] { | |
def resolveBy(id: ID): Free[RepositoryDSL, Option[E]] = Free.liftF(ResolveBy(id)) | |
def store(id: ID, entity: E): Free[RepositoryDSL, Unit] = Free.liftF(Store(id, entity)) |
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 example | |
/** | |
* 値が存在する・しないの両状態を表す型を表すトレイト。 | |
* | |
* @tparam A 値の型 | |
*/ | |
sealed trait MyOption[+A] { | |
/** |
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.io._ | |
import java.nio.charset.StandardCharsets | |
object LoarnMain extends App { | |
def getFileBody(file: String): String = | |
using(new FileInputStream(file)) { fis => | |
val text = new Array[Byte](fis.available) | |
fis.read(text) | |
new String(text, StandardCharsets.UTF_8) |
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
style = defaultWithAlign # For pretty alignment. | |
maxColumn = 100 # For my wide 30" display. | |
includeCurlyBraceInSelectChains = false | |
newlines.penalizeSingleSelectMultiArgList = false | |
project.git = true | |
project.excludeFilters = ["target/"] |
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
scala> val getTimeString = new Function0[String] { | |
| override def apply: String = ZonedDateTime.now.toString | |
| } | |
getTimeString: () => String = <function0> | |
scala> :javap getTimeString | |
Size 902 bytes | |
MD5 checksum dc6b8c20b0a3937afbe114e129c22cb9 | |
Compiled from "<console>" | |
public class $line4.$read$$iw$$iw$$iw$$iw$ |
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
class BankAccount { | |
public void setName(String name) { | |
this.name = name; | |
} | |
public void setCustomerId(long customerId) { | |
this.customerId = customerId | |
} | |