pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin - Herramienta Colaborativa - Home - View Help - Archive

Difference between
modified post 98 by ArtemGr on December Thu 10th 5:31 PM and
original post 97 by ArtemGr on December Thu 10th 5:30 PM
Show old version | new version | both versions

    
11
import scala.reflect.BeanProperty
22
case class DenormalizedRating (@BeanProperty var actLevStart: Int, @BeanProperty var actLevEnd: Int) {
33
  def this () = this (0, 0) // Default constructor for flexjson.
44
  def activityRating = actLevEnd - actLevStart
55
}
77
    def cl = new flexjson.ClassLocator {
88
      val classLoader = Thread.currentThread.getContextClassLoader
99
      override def locate (map: java.util.Map[_,_], path: flexjson.Path): Class[_] = {
1010
        if (map.containsKey ("actLevStart")) classOf[DenormalizedRating]
1111
        else {
1212
          val clazz = map.get ("class") // Flexjson class signature.
1313
          if (clazz.isInstanceOf[String]) classLoader.loadClass (clazz.toString)
1414
          else classOf[java.util.HashMap[_, _]]
1515
        }
1616
      }
1717
    }
1919
(new flexjson.JSONDeserializer () .use (null, cl) .deserialize ("""
2020
  {"foo1": "bar1",
2121
   "foo2": {"actLevStart": 1, "actLevEnd": 2},
2222
   "foo3": {"someMapKey": "someMapValue"}}
2323
""")).toString
Syntax Highlighting:
To highlight particular lines, prefix each line with @@
Pressing TAB inserts 3 spaces