I have the following Scala object:
object BusinessFacade {
/**
* Fachada para acesso aos métodos de controle de Usuário
*/
object Usuario {
private lazy val usuarioBC = new UsuarioBC
def buscar(id: Long)(implicit s: Session) = {
usuarioBC.findById(id)
}
def inserir(usuario: User)(implicit s: Session) = {
usuarioBC.insert(usuario)
}
def alterar(id: Long, usuario: User)(implicit s: Session) = {
usuarioBC.update(id, usuario)
}
def remover(id: Long)(implicit s: Session) = {
usuarioBC.delete(id)
}
def listar(numeroDaPagina: Int = 0, tamanhoDaPagina: Int = 10, filtro: String = "%")(implicit s: Session): Page[User] = {
usuarioBC.list(numeroDaPagina, tamanhoDaPagina, filtro)
}
}
/**
* Fachada para acesso aos métodos de controle de Perfil
*/
object Perfil {
private lazy val perfilBC = new PerfilBC
}
/**
* Fachada para acesso aos métodos de controle de Sistema
*/
object Sistema {
private lazy val sistemaBC = new SistemaBC
}
}
I want to get the name of each declared method of each inner object, so I am trying to do it by:
val facadeType = typeOf[BusinessFacade.type]
var permissoes = facadeType.members.filter(_.isModule).foreach { m =>
println(m.name + " ========================")
typeOf[m.type].decls.filter(_.isMethod).foreach(println)
}
With this code, I am getting the name of each inner object, but I am getting no declared methods.
Can anyone tell me why, and how could I get these methods' names??
Current output:
Sistema ========================
Perfil ========================
Usuario ========================
Desired output:
Sistema ========================
Perfil ========================
Usuario ========================
buscar
inserir
alterar
remover
listar
Aucun commentaire:
Enregistrer un commentaire