Mega Code Archive

 
Categories / Java Tutorial / Reflection
 

Has Declared Constructor

import java.lang.reflect.Constructor; public class ReflectionUtils {   public static boolean hasDeclaredConstructor(Class targetClass, Class[] partypes) {     Constructor constructor = null;     try {       constructor = targetClass.getConstructor(partypes);     }catch (Exception e) {       e.printStackTrace();     }     return constructor != null;   }    }