List of usage examples for java.lang Class getDeclaredConstructors
@CallerSensitive public Constructor<?>[] getDeclaredConstructors() throws SecurityException
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.ABSTRACT; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }/*from w ww . j ava2 s . com*/ } }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.NATIVE; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }/*from ww w . j a va 2 s . c o m*/ } }
From source file:Main.java
public static void main(String[] args) { MyClass cls = new MyClass(); Class c = cls.getClass(); // constructors Constructor[] ct = c.getDeclaredConstructors(); for (int i = 0; i < ct.length; i++) { System.out.println("Constructor found: " + ct[i].toString()); }/* w w w . j a v a 2s . c om*/ }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.PROTECTED; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }/* ww w. j a va 2 s. c om*/ } }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.PUBLIC; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }//w w w .j a v a 2s. c o m } }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.TRANSIENT; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }//from w w w. j a v a 2s.c om } }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.SYNCHRONIZED; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }// ww w .jav a2 s . com } }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.FINAL; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }/*from www . j a v a 2s. c o m*/ } }
From source file:Main.java
public static void main(String[] args) throws ClassNotFoundException { Class c = Class.forName("java.lang.String"); Constructor[] constructors = c.getDeclaredConstructors(); for (int i = 0; i < constructors.length; i++) { print_method_or_constructor(constructors[i]); }//from ww w . jav a2s.c o m }
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName(args[0]); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = modifierFromString(args[1]); int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { out.format("%s%n", ctor.toGenericString()); out.format(" [ synthetic=%-5b var_args=%-5b ]%n", ctor.isSynthetic(), ctor.isVarArgs()); }//ww w . j a va 2s . co m } }