Method | Description |
---|
asSubclass(Class<U> clazz) | It casts this Class object to represent a subclass of the class represented by the given class object. |
cast(Object obj) | It casts an object to the class or interface represented by this Class object. |
desiredAssertionStatus() | It returns the assertion status that would be assigned to this class if it was to be initialized at the time when this method is called. |
forName(String className) | It returns the Class object associated with the class or interface with the specified string name. |
forName(String name, boolean initialize,ClassLoader loader) | It returns the Class object associated with the class or interface with the specified string name, using the given class loader. |
getAnnotatedInterfaces() | It returns an array of Annotated Type objects that represents the use of types to specify super interfaces of the entity represented by this Class object. |
getAnnotatedSuperclass() | It returns an Annotated Type object that represents the usage of a type to specify the superclass of the entity as represented by this Class object. |
getAnnotation(Class<A> annotationClass) | This method returns this element's annotation for the given type, if such an annotation is present, else it returns null. |
getAnnotations() | This method returns annotations that are present on this element. |
getAnnotationsByType(Class<A>annotationClass) | This method returns annotations that are associated with this element. |
getCanonicalName() | It returns the canonical name of the underlying class as defined by the Java Language Specification. |
getClasses() | It returns an array containing Class objects representing all the public interfaces and classes that are members of the class and are represented by this Class object. |
getClassLoader() | This method returns the class loader for the class. |
getComponentType() | This method returns the Class representing the component type of an array. |
getConstructor(Class<?>... parameterTypes) | It returns a Constructor object that reflects the specified public constructor of the class represented by this Class object. |
getConstructors() | It returns an array which contains the Constructor's objects reflecting all the public constructors of the class represented by this Class object. |
getDeclaredAnnotation(Class<A>annotationClass) | It returns this element's annotation for the specified type if such an annotation is directly present, else it returns null. |
getDeclaredAnnotations() | It returns annotations that are present on this element. |
getDeclaredAnnotationsByType(Class<A> annotationClass) | It returns this element's annotation(s) for the specified type if such annotations are either directly or indirectly present. |
getDeclaredClasses() | It returns an array of Class objects reflecting all the interfaces and classes which are declared as the members of the class represented by this Class object. |
getDeclaredConstructor(Class<?>... parameterTypes) | It returns a Constructor object that reflects the given constructor of the class or interface represented by the Class object. |
getDeclaredConstructors() | It returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object. |
getDeclaredField(String name) | It returns a Field object that reflects the declared field of the class or interface represented by the Class object. |
getDeclaredMethod(String name, Class<?>... parameterTypes) | It returns a Method object that reflects the given declared method of the class or interface as represented by this Class object. |
getDeclaringClass() | It returns the class or interface represented by this Class object (which is a member of another class) and the Class object representing the class in which it was declared. |
getEnclosingClass() | It returns the immediately enclosing class of the underlying class. |
getEnclosingConstructor() | If the invoked Class's object represents a local or anonymous class within a constructor then it returns a Constructor object representing the immediately enclosing constructor of the underlying class. |
getEnclosingMethod() | If the invoked Class object represents a local or anonymous class within a method then it returns a Method object which represents the immediately enclosing method of the underlying class. |
getEnumConstants() | It returns the elements of this enum class or null if this Class object does not represent an enum type. |
getField(String name) | It returns a Field object that reflects the specified public member field of the interface or class represented by this Class object. |
getFields() | It returns an array containing Field objects reflecting all the accessible public fields of the interface or class represented by this Class object. |
getGenericInterfaces() | Returns the Types representing the interfaces directly implemented by the class or interface represented by this object |
getGenericSuperclass() | Returns the Type representing the direct superclass of the entity (class, interface, primitive type or void) represented by this Class. |
getInterfaces() | It determines the interfaces implemented by the interface or class represented by this object. |
getMethod(String name, Class<?>... parameterTypes) | It returns a method object that gives the specified public member method of the interface or class represented by this Class object |
getMethods() | It returns an array containing Method objects reflecting all the public methods of the class or interface represented by this Class object. It also includes the declared methods of the class or interface and those inherited from super classes and super interfaces |
getModifiers() | It returns the Java language modifiers for this class or interface, encoded in an integer. |
getName() | It returns the name of the entity represented by this Class object, as a String. |
getPackage() | It simply gets the package for this class. |
getProtectionDomain() | It returns the Protection Domain of this class. |
getResource(String name) | This method searches for a resource with the given name. |
getResourceAsStream(String name) | This method searches for a resource with a given name. |
getSigners() | It returns the signers of this class. |
getSimpleName() | This method returns the name of the underlying class as given in the source code. |
getSuperclass() | This method returns the Class which represents the superclass of the entity represented by this Class. |
getTypeName() | This method returns an informative string for the name of this type. |
getTypeParameters() | It returns an array of Type Variable objects that represent the type variables declared by the generic declaration represented by this Generic Declaration object, in declaration order. |
isAnnotation() | This method returns a Boolean value 'true' if this Class object represents an annotation type. |
isAnnotationPresent(Class<? extendsAnnotation> annotationClass) | This method returns a Boolean value 'true' if an annotation is present on this element, else it returns false. |
isAnonymousClass() | This method returns a Boolean value 'true' if and only if the underlying class is an anonymous class. |
isArray() | This method determines if this Class object represents an array class. |
isAssignableFrom(Class<?> cls) | This method checks if the interface or class represented by this Class object is either same, or is a superclass or super interface of the class or interface represented by the given Class parameter. |
isEnum() | It returns a Boolean value 'true' if and only if this class was declared as an enum in the source code. |
isInstance(Object obj) | It checks if the specified Object is assignment-compatible with the object represented by this Class. |
isInterface() | It checks if the given Class object represents an interface type. |
isLocalClass() | This method returns a Boolean value 'true' if the underlying class is a local class. |
isMemberClass() | This method returns a Boolean value 'true' if the underlying class is a member class. |
isPrimitive() | This method checks if the specified Class object represents a primitive type or not. |
isSynthetic() | This method returns a Boolean value 'true' if this class is a synthetic class else it returns false. |
newInstance() | This method creates a new instance of the class represented by this Class object. |
toGenericString() | This method returns a string describing this Class, including information about modifiers and the type arguments. |
toString() | This method converts the object to a string. |