Java Reflection Constructor Get getConstructorAccessor(Class enumClass, Class[] additionalParameterTypes)

Here you can find the source of getConstructorAccessor(Class enumClass, Class[] additionalParameterTypes)

Description

get Constructor Accessor

License

Open Source License

Declaration

private static Object getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
            throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.*;

public class Main {
    private static Object reflectionFactory = null;
    private static Method newConstructorAccessor = null;

    private static Object getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
            throws Exception {
        Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
        parameterTypes[0] = String.class;
        parameterTypes[1] = int.class;
        System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
        return newConstructorAccessor.invoke(reflectionFactory, enumClass.getDeclaredConstructor(parameterTypes));
    }//from   w  w  w .ja va2s.c  om
}

Related

  1. getConstructor(String className, Class... argClasses)
  2. getConstructor(String cls_name, Class[] param_cls)
  3. getConstructor(String string, Class... types)
  4. getConstructor(String type, Class[] paramTypes)
  5. getConstructor(String typeString)
  6. getConstructorCalls(Class aClass)
  7. getConstructorDescriptor(final Constructor c)
  8. getConstructorForArguments( java.lang.reflect.Constructor[] constructors, Object... arguments)
  9. getConstructorFromSignature(Class clazz, String cstrSig)