Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3 Get the current class name from a static method

i have to read the current class name inside a static method. For non-static method it's easy i just call getQualifiedClassName(this) but inside a static method this is off course invalid. Any idea ?

Thanks

like image 422
wezzy Avatar asked Mar 29 '11 17:03

wezzy


People also ask

How do I find my class name?

The simplest way is to call the getClass() method that returns the class's name or interface represented by an object that is not an array. We can also use getSimpleName() or getCanonicalName() , which returns the simple name (as in source code) and canonical name of the underlying class, respectively.

Can we use static with class name in Java?

Since static variables belong to a class, we can access them directly using class name. So, we don't need any object reference. We can only declare static variables at the class level. We can access static fields without object initialization.

Why static method is called using its class name in Java?

A static method can be called directly from the class, without having to create an instance of the class. A static method can only access static variables; it cannot access instance variables. Since the static method refers to the class, the syntax to call or refer to a static method is: class name.


1 Answers

You can use getQualifiedClassName(prototype.constructor) in the class' static method

like image 112
Elderion Avatar answered Sep 28 '22 03:09

Elderion