L2JMobius

Free Users => Shares/Contributions => Committed User Contributions => Topic started by: ReynalDev on August 17, 2019, 03:02:48 PM

Title: getSimpleName() instead getName.substring(x)
Post by: ReynalDev on August 17, 2019, 03:02:48 PM
I think this could be useful.

Use:
Code: [Select]
String className = getClass().getSimpleName());
instead

Code: [Select]
String className = getClass().getName().substring(46);
Commit: https://bitbucket.org/MobiusDev/l2j_mobius/commits/994d0aa90d7597d213ca9bbb15199f50bafbe325


Comparation:
Code: [Select]
public static void main(String[] args)
{
Config c = new Config();
System.out.println("getName --> " + c.getClass().getName());
System.out.println("getSimpleName --> " + c.getClass().getSimpleName());
}


output:
Code: [Select]
getName --> com.l2jfrozen.Config
getSimpleName --> Config
Title: Re: getSimpleName() instead getName.substring(x)
Post by: Mobius on August 17, 2019, 03:17:08 PM
Have you tested it?
Title: Re: getSimpleName() instead getName.substring(x)
Post by: ReynalDev on August 17, 2019, 03:19:08 PM
Have you tested it?

You want to know the class name of the NPC Class right? yeah im using it in L2jFrozen 1.5.
Title: Re: getSimpleName() instead getName.substring(x)
Post by: Mobius on August 17, 2019, 04:00:21 PM
Committed with revision 5794.
Thanks :D