Link Details

Link 1050701 thumbnail
User 984911 avatar

By knoldus
via blog.knoldus.com
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
  • 93
  • 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.

Voters For This Link (2)



Voters Against This Link (0)



    Java Performance Optimization
    Written by: Pierre-Hugues Charbonneau
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java EE7
    5. HTML5 Mobile
    1. Node.js
    2. Debugging JavaScript
    3. OO JS
    4. JSON
    5. Ajax