Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get class name from Class object

I have a Class object, and besides finding the class name of an object, is it possible to get the class name from the Class object?

like image 652
NebulaFox Avatar asked Oct 27 '11 11:10

NebulaFox


People also ask

How do I get the class name of an object in Python?

To get the class name of an instance in Python: Use the type() function and __name__ to get the type or class of the Object/Instance. Using the combination of the __class__ and __name__ to get the type or class of the Object/Instance.

What is getClass () getName () in Java?

The getName() method of java Class class is used to get the name of the entity, and that entity can be class, interface, array, enum, method, etc. of the class object. Element Type.

How do I find the class name in an instance?

Using attribute __name__ with type() , you can get the class name of an instance/object as shown in the example above. type() gives the class of object v and __name__ gives the class name.

What is class forName ()?

forName(String name, boolean initialize, ClassLoader loader) method returns the Class object associated with the class or interface with the given string name, using the given class loader. The specified class loader is used to load the class or interface.


1 Answers

If you just need the class name, consider using flash.utils.getQualifiedClassName. describeType operations can be slow so if you don't need the other data it will be faster.

like image 119
sean Avatar answered Oct 29 '22 13:10

sean