1, the constructor method to give
- Constructor getConstructor (Class [] params) - parameters obtained using special types of public constructors,
- Constructor [] getConstructors () - all obtained class public constructors
- Constructor getDeclaredConstructor (Class [] params) - Constructor obtained using type specific parameters (regardless of access priority)
- Constructor [] getDeclaredConstructors () - all the constructors class obtained (regardless of access priority)
2, the method of obtaining field information
- Field getField (String name) - Public obtain field named
- Field [] getFields () - get all the public fields of the class
- Field getDeclaredField (String name) - get the class declaration of the named field
- Field [] getDeclaredFields () - get all the fields declared by the class
3. A method for obtaining information
- Method getMethod (String name, Class [] params) - type specific parameters used to obtain public method named
- Method [] getMethods () - get all public methods in the class
- Method getDeclaredMethod (String name, Class [] params) - close-up parameter types, the class declaration is obtained a method of naming
- Method [] getDeclaredMethods () - get all methods declared by the class
Summary: ======== >>>>>>>> with DeclaredMethod acquisition method of the present kind of private field does not include a value related to the parent, the method can only be obtained with no public class fields according to the present method, parent field and related method
4: method to get annotated
The Annotation 1. [] Annotations = (the Annotation []) class1.getAnnotations (); // Get all annotations class object
2. Annotation the Annotation = (the Annotation) class1.getAnnotation (Deprecated.class); // Get the specified class object annotation
genericSuperclass class1.getGenericSuperclass the type = 3. (); // get the object class direct superclass
4. the type the type [] = interfaceTypes class1.getGenericInterfaces (); type // set all the acquired object class interfaces
5: other expansion method
- boolean isPrimitive = class1.isPrimitive (); // determines whether base-type
- boolean isArray = class1.isArray (); // determines whether collections
- boolean isAnnotation = class1.isAnnotation (); // determines whether the annotation class
- boolean isInterface = class1.isInterface (); // determines whether the interface class
- boolean isEnum = class1.isEnum (); // determines whether an enumeration class
- boolean isAnonymousClass = class1.isAnonymousClass (); // determines whether anonymous inner classes
- boolean isAnnotationPresent = class1.isAnnotationPresent (Deprecated.class); // determines whether a modified class annotated
- String className = class1.getName (); // get class names include the package name path
- Package aPackage = class1.getPackage (); // class of acquiring package information
- String simpleName = class1.getSimpleName (); // get class class name
- int modifiers = class1.getModifiers (); // get access to class
- Class<?>[] declaredClasses = class1.getDeclaredClasses();//内部类
- Class<?> declaringClass = class1.getDeclaringClass();//外部类
- getSuperclass (): Gets the class of the parent class
- getInterfaces (): Gets an interface implemented certain
6. type having
- ParameterizedType: shows a parameterized type, such as Collection <String>
- GenericArrayType: represents an element type is an array type parameters or type of variable types
- TypeVariable: the interface is the common parent of all types of variables
-
WildcardType: represents a wildcard type expression, such as? ,? extends Number ,? super Integer. (Wildcard is a word: is the "wildcard")