repository.grepcode.com$java$root@jdk$openjdk@6-b14@java$beans$NameGenerator.java
oh
o
[{"sl":109,"sc":-1,"el":109,"ec":-1,"m":"Method java.beans.NameGenerator.instanceName(Object) invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead","p":2,"t":"DM_NUMBER_CTOR","a":"Bx","c":"PERFORMANCE"}]
import static java.util.Locale.ENGLISH;
A utility class which generates unique names for object instances.
The name will be a concatenation of the unqualified class name
and an instance number.
For example, if the first object instance javax.swing.JButton
is passed into instanceName then the returned
string identifier will be "JButton0".
Clears the name cache. Should be called to near the end of
the encoding cycle.
Returns the root name of the class.
Returns a String which capitalizes the first letter of the string.
if (name == null || name.length() == 0) { Returns a unique string which identifies the object instance.
Invocations are cached so that if an object has been previously
passed into this method then the same identifier is returned.
- Parameters:
instance object used to generate string- Returns:
- a unique string representing the object
if (instance instanceof Class) { result = className + instanceNumber;