How can I determine components name as string using java?

How can I determine components name as string using java?

Please help me if this is possible by Java


I want to get components name as string using java. I want to determine like PackageName1, PackageName2 as string format.

Please help me anyone if it’s possible.

(Thanks for your time)

I didn’t get you exactly.
May you please elaborate. What extension name you want to get .
Do you want to get extensions name of a project through java??

1 Like

I want to know that, how many times user dragged my extension in same screen.

Using this trick, if user drag one time, then it should “MyExtensionName1”, and if user dragged for two times, then it should “MyExtensionName2”. I want to determine that name as string from java.

I think you got my point?

Got it…

I don’t know correctly. But AFAIK, it is possible through form. Let me try it then I will tell you if I success​:upside_down_face:

Thanks dear for your time :+1:

You can’t know that information from the designer.
You may be able to track it at runtime, when using companion or apk.
But why do you need it?

Dear @sonumohammad333, I don’t want to get this information from designer section, I want to get this information using java for my own built extensions.

If you’ve solution, then please help me.

You just want to allow only one instance of your extension at runtime and want to avoid conflict, right?

Yes and I’ve one more reason. Is it possible to determine component name as string?

For the whole app?

public static boolean instanceCreated = false

Check when creating instance.

if (YourExtClassName.instanceCreated) {
     // Do something to avoid creating multiple instances
    isValidInstance = false;
} else {
    YourExtClass.instanceCreated = true;
    isValidInstance = true;

You can check isValidInstance variable later to validate and throw runtime error
“This is not first instance of extension, you can only use one instance”

1 Like

No, component names are just for representation during development.

I may help you if you elaborate on it.

Do it the component block.You will get a string representation of that particular component.