Get class name while in CoroutineScope Kotlin - class

javaClass.simpleName returns StanadloneCoroutinejava instead of class name name when it is called from within coroutine scope.
I want to get the upper level class name. Any ideas how can I do so?

I think if you do this#NameOfClass::class.simpleName you'll get the correct name.

Related

Collect all annotated class name in some scala object

We have various class annotated with a scala macro annotation that add a method to that class. At compile time, We want to add a list of these annotated class in some other object . So that we can access that list at run time. Is there any way to achieve this?
I didn't find a straight way to do this but what I did was pretty simple. Whenever my macro finds my annotated class, It writes the name of the class to a file in resources. At runtime, I made that file content available as a list through a new class method.

Find method in scala reflect by it's bytecode name

Is there a way to find a method by it's bytecode name?
For example, I would like to find a reference to println(Object) by string "_root_.scala.Predef.println(Ljava/lang/Object;)V."
There is no direct way to do it.
You have to parse string to extract class name. Load class by name and iterate thru its method to find required method.

How to print the object name (not class) in Swift?

From this answer, I know that I can get the name of the class type using
NSStringFromClass(YourClassName)
But I actually also need the name of the current object instance. So if I have code like this:
let loginForm = LoginFormViewController();
I want to actually get the loginForm in string, within the implementation of LoginFormViewController.
How can I do that?

Scala how to get object property value given name of property in string?

I wondering how to get object property value given name of property in string in Scala? I saw examples when you get all fields of object using Reflection and iterate over it. But is it possible to call it without iteration? Or may be there is a way to pass object.field to another function without evaluation and evaluate it there and return result?
Kolmar comment give me right direction to call by name function.

Using a class function to find a file, and include it so the class in that file can be used

So far this one seems to go against the grain of Php OOP. Let me explain further with an example.
class main has a function called get($name), what I would like get to do is based on the value of $name, (e.g. 'path/file') would find the corresponding file and include it, so the class in path/file can be used.
My goal with this and the reason I want to do this, is when I call $main->get('path/file'), I'd like an object returned of the class within the file, so far the only solution I can figure out is to use
include($main->get('path/file'));
And within said file would be an object defined outside the class body within path/file.php, but that doesn't really solve the issue as it limits me to using the object defined in that file, and I can only use this include call outside a class body. Does anyone have any ideas on how this can be approached?