Skip to content

Commit

Permalink
Address the review.
Browse files Browse the repository at this point in the history
  • Loading branch information
folone committed Feb 22, 2015
1 parent e5da332 commit 55b7e8b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012 Twitter, Inc.
Copyright 2015 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package com.twitter.bijection.twitter_finagle
package com.twitter.bijection.finagle_mysql

import com.twitter.finagle.exp.mysql._
import com.twitter.bijection._
import scala.util.Try
import java.sql.Timestamp

/**
Expand Down Expand Up @@ -76,19 +75,19 @@ trait MySqlInjections {
private val UTC = java.util.TimeZone.getTimeZone("UTC")
private val timestampValue = new TimestampValue(UTC, UTC)
def apply(t: Timestamp) = timestampValue(t)
override def invert(v: Value) = Try(timestampValue.unapply(v).get)
override def invert(v: Value) = Inversion.attempt(timestampValue.unapply(v).get)(identity)
}

implicit def nullValue[A]: Injection[NullValue.type, Option[A]] =
new AbstractInjection[NullValue.type, Option[A]] {
def apply(n: NullValue.type) = None
override def invert(n: Option[A]) = Try(n.map(_ => NullValue).get)
override def invert(n: Option[A]) = Inversion.attempt(n.map(_ => NullValue).get)(identity)
}

implicit def emptyValue[A]: Injection[EmptyValue.type, Option[A]] =
new AbstractInjection[EmptyValue.type, Option[A]] {
def apply(n: EmptyValue.type) = None
override def invert(n: Option[A]) = Try(n.map(_ => EmptyValue).get)
override def invert(n: Option[A]) = Inversion.attempt(n.map(_ => EmptyValue).get)(identity)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012 Twitter, Inc.
Copyright 2015 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package com.twitter.bijection.twitter_finagle
package com.twitter.bijection.finagle_mysql

import com.twitter.bijection.{ BaseProperties, Bijection }
import org.scalacheck.Arbitrary
Expand Down
6 changes: 3 additions & 3 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ object BijectionBuild extends Build {
bijectionScrooge,
bijectionJson,
bijectionUtil,
bijectionFinagle,
bijectionFinagleMySql,
bijectionClojure,
bijectionNetty,
bijectionAvro,
Expand Down Expand Up @@ -238,8 +238,8 @@ object BijectionBuild extends Build {
libraryDependencies += "com.twitter" %% "util-core" % "6.20.0"
).dependsOn(bijectionCore % "test->test;compile->compile")

lazy val bijectionFinagle = module("finagle").settings(
osgiExportAll("com.twitter.bijection.twitter_finagle"),
lazy val bijectionFinagleMySql = module("finagle-mysql").settings(
osgiExportAll("com.twitter.bijection.finagle_mysql"),
libraryDependencies += "com.twitter" %% "finagle-mysql" % "6.24.0"
).dependsOn(bijectionCore % "test->test;compile->compile")

Expand Down

0 comments on commit 55b7e8b

Please sign in to comment.