Skip to content

Instantly share code, notes, and snippets.

@lazyval
Forked from phearnot/gist:3762546
Created September 21, 2012 16:58
Show Gist options
  • Save lazyval/3762651 to your computer and use it in GitHub Desktop.
Save lazyval/3762651 to your computer and use it in GitHub Desktop.
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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment