KunLun :
I have this ste.getClassName()
which return a String
like this pack.age.Foo
.
ste
is StackTraceElement
.
How I could get only Foo
? Or the only way is to do a method which extract Foo
from that string?
Mureinik :
There isn't a built in method for that. You could break up the string like @Naya and @Daniel Perez suggested, or let Class
to the heavy lifting for you:
String simpleName = Class.forName(ste.getClassName()).getSimpleName();