vendredi 17 mai 2019

How to get name of all methods in a scala trait

I need all the method names in a scala trait i've defined. I know this sounds like a trivial problem but i could not find any answers relating to trait, they all revolved around classes.

To be specific, i need names for all the abstract methods. But if i can get name of all methods regardless of abstract or not, that works too.

Say I have this trait A

trait A {
  def myDefinedInt: Int = 2
  def myAbstractString: String
}

I need a list of all methods (or preferably just the abstract ones)

I'm relatively new to scala so although i get classes and interfaces. Traits are new to me.

Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire