/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }
/** * Returns the simple name of the class represented by this {@code Class} as * defined in the source code. If there is no name (that is, the class is * anonymous) then an empty string is returned. If the receiver is an array * then the name of the underlying type with square braces appended (for * example {@code "Integer[]"}) is returned. * * @return the simple name of the class represented by this {@code Class}. */ public String getSimpleName() { if (isArray()) { return getComponentType().getSimpleName() + "[]"; } String name = getName(); if (isAnonymousClass()) { return ""; } if (isMemberClass() || isLocalClass()) { return getInnerClassName(); } int dot = name.lastIndexOf('.'); if (dot != -1) { return name.substring(dot + 1); } return name; }