Last active
January 22, 2016 17:53
-
-
Save zeryx/0b869f403e927652706c to your computer and use it in GitHub Desktop.
generic apply method constructors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by james on 22/01/16. | |
*/ | |
sealed class GenericRecommender extends Constructors{ | |
def apply(constructor: GenericConstructor){ | |
constructor match{ | |
case StdOperation(operationType, algorithmID, properties) => | |
... | |
case NewRec(rectType, algorithmID, properties) => | |
... | |
} | |
} | |
} | |
trait Constructors { | |
abstract class GenericConstructor | |
case class StdOperation(operationType: String, | |
algorithmID: String, | |
properties: Map[String, String]) extends GenericConstructor | |
case class NewRec(recType: String, | |
algorithmID: String, | |
properties: Map[String, String]) extends GenericConstructor | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment