Link Details

Link 1050701 thumbnail
User 984911 avatar

By knoldus
Submitted: Oct 17 2013 / 02:48

We use the awesome Lift Json library in quite a few our projects. It allows for easy customization and is handy for writing and parsing JSON strings. One of the situations which could possibly push you against the wall is when you have classes extending traits. Let us look at this quick example trait Reducer case class SentimentReducer(name:String, coefficientLevel:Double) extends Reducer case class EmotionReducer(name:String, coefficientLevel:Double) extends Reducer case class Analysis(dataCubeName:String, reductionSteps:List[Reducer]) We have the situation like above where we have the Reducer trait. The Reducer can have multiple implementations as we have above. Finally, the Analysis class takes the data cube on which it has to work and a list of reductionSteps each one of which is individually a Reducer.
  • 2
  • 0
  • 103
  • 32

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Upvoters (2)

Downvoters (0)

    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java