Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added java.sql.Timestamp to net.liftweb.json Extraction #1308

Closed
wants to merge 1 commit into from

5 participants

kevg Antonio Salazar Cardozo David Pollak Richard Dallaway Franz Bettag
kevg

I ran into a problem where a Mapper MappedDateTime was not being serialized by net.liftweb.json.Extraction. It turns out this is because MappedDateTime.is returns a java.sql.Timestamp, which although is a subclass of java.util.Date, lift json did not support.

Antonio Salazar Cardozo
Owner

Note that we can't accept pull requests. See http://liftweb.net/community for more.

kevg

Okay. There are some well known patterns you can consider that many Eclipse & Apache projects use: When a patch is submitted, a set of questions are asked to the person such as the code's provenance, etc.

Antonio Salazar Cardozo
Owner

There's been a multitude of discussions about this on the list; please go ahead and peruse them for more details.

David Pollak
Owner

We have chosen a set of patterns and rules for contribution and we advertise them. We do not have any plans to revisit them. Thanks.

Richard Dallaway
Owner

To help avoid confusions, I could look at modifying the first section of https://github.com/lift/framework/blob/master/README.md to highlight the policy.

Franz Bettag
Collaborator

I think this is a good idea, since most of the people writing patches would be looking at the GitHub Repo's first few paragraphs rather than the last paragraph and then the website :)

David Pollak
Owner

Great idea!

Richard Dallaway d6y referenced this pull request from a commit
Richard Dallaway d6y Added prominent section indicating no pull requests, in relation to c…
…omments in #1308

Also corrected a typo and updated link to the new modules repositories.
3891f0b
kevg

Thanks.

Richard Dallaway d6y referenced this pull request from a commit
Richard Dallaway d6y Added prominent section indicating no pull requests, in relation to c…
…omments in #1308

Also corrected a typo and updated link to the new modules repositories.
b9e4de9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. kevg
This page is out of date. Refresh to see the latest.
2  core/json/src/main/scala/net/liftweb/json/Extraction.scala
View
@@ -391,7 +391,7 @@ object Extraction {
case JDouble(x) if (targetType == classOf[Number]) => x
case JString(s) if (targetType == classOf[String]) => s
case JString(s) if (targetType == classOf[Symbol]) => Symbol(s)
- case JString(s) if (targetType == classOf[Date]) => formats.dateFormat.parse(s).getOrElse(fail("Invalid date '" + s + "'"))
+ case JString(s) if (classOf[Date].isAssignableFrom(targetType)) => formats.dateFormat.parse(s).getOrElse(fail("Invalid date '" + s + "'"))
case JBool(x) if (targetType == classOf[Boolean]) => x
case JBool(x) if (targetType == classOf[JavaBoolean]) => new JavaBoolean(x)
case j: JValue if (targetType == classOf[JValue]) => j
4 core/json/src/main/scala/net/liftweb/json/Meta.scala
View
@@ -19,6 +19,7 @@ package json
import java.lang.reflect.{Constructor => JConstructor, Field, Type, ParameterizedType, GenericArrayType}
import java.util.Date
+import java.sql.Timestamp
case class TypeInfo(clazz: Class[_], parameterizedType: Option[ParameterizedType])
@@ -215,7 +216,7 @@ private[json] object Meta {
classOf[Short], classOf[java.lang.Integer], classOf[java.lang.Long],
classOf[java.lang.Double], classOf[java.lang.Float],
classOf[java.lang.Byte], classOf[java.lang.Boolean], classOf[Number],
- classOf[java.lang.Short], classOf[Date], classOf[Symbol], classOf[JValue],
+ classOf[java.lang.Short], classOf[Date], classOf[Timestamp], classOf[Symbol], classOf[JValue],
classOf[JObject], classOf[JArray]).map((_, ())))
private val primaryConstructors = new Memo[Class[_], List[(String, Type)]]
@@ -392,6 +393,7 @@ private[json] object Meta {
case x: java.lang.Byte => JInt(BigInt(x.asInstanceOf[Byte]))
case x: java.lang.Boolean => JBool(x.asInstanceOf[Boolean])
case x: java.lang.Short => JInt(BigInt(x.asInstanceOf[Short]))
+ case x: java.sql.Timestamp => JString(formats.dateFormat.format(x))
case x: Date => JString(formats.dateFormat.format(x))
case x: Symbol => JString(x.name)
case _ => sys.error("not a primitive " + a.asInstanceOf[AnyRef].getClass)
Something went wrong with that request. Please try again.