Here you can find the source of className(Object o)
Parameter | Description |
---|---|
o | may be null |
public static String className(Object o)
//package com.java2s; /******************************************************************************* * Copyright (c) 2005-2012 eBay Inc.//from w w w . jav a 2 s .c o m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * *******************************************************************************/ public class Main { /** * Readable class name (i.e., not unqualified) * * @param o * may be null * @return readable String class name */ public static String className(Object o) { if (null == o) { return "NOCLASS"; } if (o instanceof Class) { return ((Class<?>) o).getSimpleName(); } // implemetn short/long name policy for those who don't care return o.getClass().getSimpleName(); } }