Java Reflection Constructor Get getConstructorLabel(java.lang.reflect.Constructor con)

Here you can find the source of getConstructorLabel(java.lang.reflect.Constructor con)

Description

get Constructor Label

License

Open Source License

Declaration

public static String getConstructorLabel(java.lang.reflect.Constructor<?> con) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright ? 2012, 2013 IBM Corporation and others.
 * 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
 *
 * Contributors://from   w ww . j  a  va 2 s . co  m
 * IBM Corporation - initial API and implementation
 *
 *******************************************************************************/

public class Main {
    public static String getConstructorLabel(java.lang.reflect.Constructor<?> con) {
        StringBuilder buffer = new StringBuilder(60);
        buffer.append(con.getDeclaringClass().getSimpleName());
        buffer.append('(');

        Class<?>[] paraTypes = con.getParameterTypes();
        for (int i = 0; i < paraTypes.length; i++) {
            buffer.append(paraTypes[i].getSimpleName());
            if (i < paraTypes.length - 1) {
                buffer.append(',');
            }
        }
        buffer.append(')');

        return buffer.toString();
    }
}

Related

  1. getConstructorCalls(Class aClass)
  2. getConstructorDescriptor(final Constructor c)
  3. getConstructorForArguments( java.lang.reflect.Constructor[] constructors, Object... arguments)
  4. getConstructorFromSignature(Class clazz, String cstrSig)
  5. getConstructorIfAvailable(Class clazz, Class... paramTypes)
  6. getConstructorOptional(Class cls, Class... argsTypes)
  7. getConstructorOrFail(Class clazz, Class... argTypes)
  8. getConstructors(Class cl)
  9. getConstructors(Class infoClass)