#Mac OS X
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
// it's good style to mark such objects/classes with sealed to guide complier | |
// so it will check if match is exhaustive (all possible cases covered) | |
sealed abstract class Response | |
sealed abstract class Reason | |
abstract class TokenType | |
case class Token(t: TokenType) extends Response | |
case class Problem(reason: Reason) extends Response | |
case object InvalidResponse extends Reason |
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
implicit val bdStringView = StringView.of[BigDecimal] as { _.toString } | |
def makeStringValue[T](implicit sv: StringView[T]) = new StringValue { | |
def getString(value: AnyRef) = sv(value.asInstanceOf[T]) | |
} | |
bdStringValue = makeStringValue[BigDecimal] | |
strStringValue = makeStringValue[String] | |
qtyStringValue = makeStringValue[Long](StringView.of[Long] as { _.toString } |
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
/** | |
* dirwatcher.scala | |
* | |
* Uses the Java 7 WatchEvent filesystem API from within Scala. | |
* Adapted from: | |
* http://download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java | |
* | |
* @author Chris Eberle <[email protected]> | |
* @version 0.1 | |
*/ |