Java java.lang Class fields, constructors, methods, implement or subclass

Example usage for Java java.lang Class fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.lang Class.

The text is from its open source code.

Field

Stringname

Constructor

Method

ClassasSubclass(Class clazz)
Casts this Class object to represent a subclass of the class represented by the specified class object.
Tcast(Object obj)
Casts an object to the class or interface represented by this Class object.
Objectclone()
Creates and returns a copy of this object.
booleandesiredAssertionStatus()
Returns the assertion status that would be assigned to this class if it were to be initialized at the time this method is invoked.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
ClassforName(String className)
Returns the Class object associated with the class or interface with the given string name.
ClassforName(String name, boolean initialize, ClassLoader loader)
Returns the Class object associated with the class or interface with the given string name, using the given class loader.
AgetAnnotation(Class annotationClass)
Annotation[]getAnnotations()
A[]getAnnotationsByType(Class annotationClass)
StringgetCanonicalName()
Returns the canonical name of the underlying class as defined by the Java Language Specification.
ClassgetClass()
Returns the runtime class of this Object .
Class[]getClasses()
Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object.
ClassLoadergetClassLoader()
Returns the class loader for the class.
ClassgetComponentType()
Returns the Class representing the component type of an array.
ConstructorgetConstructor(Class... parameterTypes)
Returns a Constructor object that reflects the specified public constructor of the class represented by this Class object.
Constructor[]getConstructors()
Returns an array containing Constructor objects reflecting all the public constructors of the class represented by this Class object.
AgetDeclaredAnnotation(Class annotationClass)
Annotation[]getDeclaredAnnotations()
A[]getDeclaredAnnotationsByType(Class annotationClass)
Class[]getDeclaredClasses()
Returns an array of Class objects reflecting all the classes and interfaces declared as members of the class represented by this Class object.
ConstructorgetDeclaredConstructor(Class... parameterTypes)
Returns a Constructor object that reflects the specified constructor of the class or interface represented by this Class object.
Constructor[]getDeclaredConstructors()
Returns an array of Constructor objects reflecting all the constructors declared by the class represented by this Class object.
FieldgetDeclaredField(String name)
Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.
Field[]getDeclaredFields()
Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object.
MethodgetDeclaredMethod(String name, Class... parameterTypes)
Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object.
Method[]getDeclaredMethods()
Returns an array containing Method objects reflecting all the declared methods of the class or interface represented by this Class object, including public, protected, default (package) access, and private methods, but excluding inherited methods.
ClassgetDeclaringClass()
If the class or interface represented by this Class object is a member of another class, returns the Class object representing the class in which it was declared.
ClassgetEnclosingClass()
Returns the immediately enclosing class of the underlying class.
ConstructorgetEnclosingConstructor()
If this Class object represents a local or anonymous class within a constructor, returns a java.lang.reflect.Constructor Constructor object representing the immediately enclosing constructor of the underlying class.
MethodgetEnclosingMethod()
If this Class object represents a local or anonymous class within a method, returns a java.lang.reflect.Method Method object representing the immediately enclosing method of the underlying class.
T[]getEnumConstants()
Returns the elements of this enum class or null if this Class object does not represent an enum type.
FieldgetField(String name)
Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object.
Field[]getFields()
Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object.
Type[]getGenericInterfaces()
Returns the Type s representing the interfaces directly implemented by the class or interface represented by this object.
TypegetGenericSuperclass()
Returns the Type representing the direct superclass of the entity (class, interface, primitive type or void) represented by this Class .
Class[]getInterfaces()
Returns the interfaces directly implemented by the class or interface represented by this object.
MethodgetMethod(String name, Class... parameterTypes)
Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.
Method[]getMethods()
Returns an array containing Method objects reflecting all the public methods of the class or interface represented by this Class object, including those declared by the class or interface and those inherited from superclasses and superinterfaces.
intgetModifiers()
Returns the Java language modifiers for this class or interface, encoded in an integer.
StringgetName()
Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object, as a String .
PackagegetPackage()
Gets the package of this class.
java.security.ProtectionDomaingetProtectionDomain()
Returns the ProtectionDomain of this class.
URLgetResource(String name)
Finds a resource with a given name.
InputStreamgetResourceAsStream(String name)
Finds a resource with a given name.
StringgetSimpleName()
Returns the simple name of the underlying class as given in the source code.
ClassgetSuperclass()
Returns the Class representing the direct superclass of the entity (class, interface, primitive type or void) represented by this Class .
StringgetTypeName()
Return an informative string for the name of this type.
TypeVariable>[]getTypeParameters()
Returns an array of TypeVariable objects that represent the type variables declared by the generic declaration represented by this GenericDeclaration object, in declaration order.
inthashCode()
Returns a hash code value for the object.
booleanisAnnotation()
Returns true if this Class object represents an annotation type.
booleanisAnnotationPresent(Class annotationClass)
booleanisAnonymousClass()
Returns true if and only if the underlying class is an anonymous class.
booleanisArray()
Determines if this Class object represents an array class.
booleanisAssignableFrom(Class cls)
Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.
booleanisEnum()
Returns true if and only if this class was declared as an enum in the source code.
booleanisInstance(Object obj)
Determines if the specified Object is assignment-compatible with the object represented by this Class .
booleanisInterface()
Determines if the specified Class object represents an interface type.
booleanisLocalClass()
Returns true if and only if the underlying class is a local class.
booleanisMemberClass()
Returns true if and only if the underlying class is a member class.
booleanisPrimitive()
Determines if the specified Class object represents a primitive type.
booleanisSynthetic()
Returns true if this class is a synthetic class; returns false otherwise.
TnewInstance()
Creates a new instance of the class represented by this Class object.
StringtoGenericString()
Returns a string describing this Class , including information about modifiers and type parameters.
StringtoString()
Converts the object to a string.