Here you can find the source of className(final Class> c)
Parameter | Description |
---|---|
c | the class |
public static final String className(final Class<?> c)
//package com.java2s; //License from project: Open Source License public class Main { /**// www . jav a2 s .co m * Get an easy-to-use representation of a class. * * @param c * the class * @return the name */ public static final String className(final Class<?> c) { String s; if (c == null) { return "No class specified."; //$NON-NLS-1$ } s = c.getCanonicalName(); if ((s != null) && (s.length() > 0)) { return s; } s = c.getName(); if ((s != null) && (s.length() > 0)) { return s; } s = c.getSimpleName(); if ((s != null) && (s.length() > 0)) { return s; } s = c.toString(); if ((s != null) && (s.length() > 0)) { return s; } return "nameless"; //$NON-NLS-1$ } }