Trying to create a "provider" in scala using generics -


i trying create provider class in scala return correct object when called

trait

trait remotevalidator[a <:widget]{ def processremotevalidation(request: eventrequest[_], widget: a):     future[seq[widget]] } 

class extending trait

class resourceinstancelistremotevalidator @inject() extends remotevalidator[instancelistwidget[instancewidget]] {    override def processremotevalidation(request: eventrequest[_], widget: instancelistwidget[instancewidget]): future[seq[widget]] = {      //stuff   } 

provider

class remotevalidatorprovider[t] @inject()(resourceinstancelistremotevalidator: resourceinstancelistremotevalidator) {  val validators = map("resources" -> resourceinstancelistremotevalidator)  def getremotevalidator(key: string): option[remotevalidator] = {  validators.get(key)  } } 

the issuse when call provider.processremotevalidation(request, instancelistwidget) "type mismatch expected type a, actual instancelistwidget[instancewidget]. know work in java, not familiar generics in scala, should doing instead?


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -