Suppose there is the code
sealed trait SomeTrait
case class SomeClass() extends SomeTrait
case object SomeObject extends SomeTrait
And then the someTraitType: Type is obtained via reflection.
To check that someTraitType is the type of SomeClass it can be done easily someTraitType =:= typeOf[SomeClass].
The question is how can someTraitType be checked that is SomeObject?
And a following question, can the SomeObject instance be obtained from having corresponding Type so a simple == can be performed?
Aucun commentaire:
Enregistrer un commentaire