|
@@ -193,7 +193,7 @@ private Class(ClassLoader loader, Class<?> arrayComponentType) { |
|
|
* "void". If this {@code Class} object represents an array type, |
|
|
* this method returns "class " followed by {@code getName}. |
|
|
* |
|
|
* @return a string representation of this class object. |
|
|
* @return a string representation of this {@code Class} object. |
|
|
*/ |
|
|
public String toString() { |
|
|
return (isInterface() ? "interface " : (isPrimitive() ? "" : "class ")) |
|
@@ -679,10 +679,10 @@ public Void run() { |
|
|
|
|
|
|
|
|
/** |
|
|
* Determines if the specified {@code Class} object represents an |
|
|
* Determines if this {@code Class} object represents an |
|
|
* interface type. |
|
|
* |
|
|
* @return {@code true} if this object represents an interface; |
|
|
* @return {@code true} if this {@code Class} object represents an interface; |
|
|
* {@code false} otherwise. |
|
|
*/ |
|
|
@HotSpotIntrinsicCandidate |
|
@@ -692,7 +692,7 @@ public Void run() { |
|
|
/** |
|
|
* Determines if this {@code Class} object represents an array class. |
|
|
* |
|
|
* @return {@code true} if this object represents an array class; |
|
|
* @return {@code true} if this {@code Class} object represents an array class; |
|
|
* {@code false} otherwise. |
|
|
* @since 1.1 |
|
|
*/ |
|
@@ -736,7 +736,7 @@ public Void run() { |
|
|
* type. Note that if this method returns true, {@link #isInterface()} |
|
|
* would also return true, as all annotation types are also interfaces. |
|
|
* |
|
|
* @return {@code true} if this class object represents an annotation |
|
|
* @return {@code true} if this {@code Class} object represents an annotation |
|
|
* type; {@code false} otherwise |
|
|
* @since 1.5 |
|
|
*/ |
|
@@ -761,16 +761,16 @@ public boolean isSynthetic() { |
|
|
* primitive type, or void) represented by this {@code Class} object, |
|
|
* as a {@code String}. |
|
|
* |
|
|
* <p> If this class object represents a reference type that is |
|
|
* <p> If this {@code Class} object represents a reference type that is |
|
|
* not an array type then the binary name of the class is |
|
|
* returned, as specified by <cite>The Java™ Language |
|
|
* Specification</cite>. |
|
|
* |
|
|
* <p> If this class object represents a primitive type or void, then the |
|
|
* <p> If this {@code Class} object represents a primitive type or void, then the |
|
|
* name returned is a {@code String} equal to the Java language |
|
|
* keyword corresponding to the primitive type or void. |
|
|
* |
|
|
* <p> If this class object represents a class of arrays, then the internal |
|
|
* <p> If this {@code Class} object represents a class of arrays, then the internal |
|
|
* form of the name consists of the name of the element type preceded by |
|
|
* one or more '{@code [}' characters representing the depth of the array |
|
|
* nesting. The encoding of element type names is as follows: |
|
@@ -810,7 +810,7 @@ public boolean isSynthetic() { |
|
|
* </pre></blockquote> |
|
|
* |
|
|
* @return the name of the class or interface |
|
|
* represented by this object. |
|
|
* represented by this {@code Class} object. |
|
|
*/ |
|
|
public String getName() { |
|
|
String name = this.name; |
|
@@ -828,11 +828,11 @@ public String getName() { |
|
|
* null in such implementations if this class was loaded by the bootstrap |
|
|
* class loader. |
|
|
* |
|
|
* <p>If this object |
|
|
* <p>If this {@code Class} object |
|
|
* represents a primitive type or void, null is returned. |
|
|
* |
|
|
* @return the class loader that loaded the class or interface |
|
|
* represented by this object. |
|
|
* represented by this {@code Class} object. |
|
|
* @throws SecurityException |
|
|
* if a security manager is present, and the caller's class loader |
|
|
* is not {@code null} and is not the same as or an ancestor of the |
|
@@ -918,11 +918,11 @@ public Module getModule() { |
|
|
* entity (class, interface, primitive type or void) represented by |
|
|
* this {@code Class}. If this {@code Class} represents either the |
|
|
* {@code Object} class, an interface, a primitive type, or void, then |
|
|
* null is returned. If this object represents an array class then the |
|
|
* {@code Class} object representing the {@code Object} class is |
|
|
* null is returned. If this {@code Class} object represents an array class |
|
|
* then the {@code Class} object representing the {@code Object} class is |
|
|
* returned. |
|
|
* |
|
|
* @return the direct superclass of the class represented by this object |
|
|
* @return the direct superclass of the class represented by this {@code Class} object |
|
|
*/ |
|
|
@HotSpotIntrinsicCandidate |
|
|
public native Class<? super T> getSuperclass(); |
|
@@ -931,7 +931,7 @@ public Module getModule() { |
|
|
/** |
|
|
* Returns the {@code Type} representing the direct superclass of |
|
|
* the entity (class, interface, primitive type or void) represented by |
|
|
* this {@code Class}. |
|
|
* this {@code Class} object. |
|
|
* |
|
|
* <p>If the superclass is a parameterized type, the {@code Type} |
|
|
* object returned must accurately reflect the actual type |
|
@@ -940,10 +940,10 @@ public Module getModule() { |
|
|
* created before. See the declaration of {@link |
|
|
* java.lang.reflect.ParameterizedType ParameterizedType} for the |
|
|
* semantics of the creation process for parameterized types. If |
|
|
* this {@code Class} represents either the {@code Object} |
|
|
* this {@code Class} object represents either the {@code Object} |
|
|
* class, an interface, a primitive type, or void, then null is |
|
|
* returned. If this object represents an array class then the |
|
|
* {@code Class} object representing the {@code Object} class is |
|
|
* returned. If this {@code Class} object represents an array class |
|
|
* then the {@code Class} object representing the {@code Object} class is |
|
|
* returned. |
|
|
* |
|
|
* @throws java.lang.reflect.GenericSignatureFormatError if the generic |
|
@@ -955,7 +955,7 @@ public Module getModule() { |
|
|
* @throws java.lang.reflect.MalformedParameterizedTypeException if the |
|
|
* generic superclass refers to a parameterized type that cannot be |
|
|
* instantiated for any reason |
|
|
* @return the direct superclass of the class represented by this object |
|
|
* @return the direct superclass of the class represented by this {@code Class} object |
|
|
* @since 1.5 |
|
|
*/ |
|
|
public Type getGenericSuperclass() { |
|
@@ -1044,13 +1044,13 @@ public String getPackageName() { |
|
|
|
|
|
/** |
|
|
* Returns the interfaces directly implemented by the class or interface |
|
|
* represented by this object. |
|
|
* represented by this {@code Class} object. |
|
|
* |
|
|
* <p>If this object represents a class, the return value is an array |
|
|
* <p>If this {@code Class} object represents a class, the return value is an array |
|
|
* containing objects representing all interfaces directly implemented by |
|
|
* the class. The order of the interface objects in the array corresponds |
|
|
* to the order of the interface names in the {@code implements} clause of |
|
|
* the declaration of the class represented by this object. For example, |
|
|
* the declaration of the class represented by this {@code Class} object. For example, |
|
|
* given the declaration: |
|
|
* <blockquote> |
|
|
* {@code class Shimmer implements FloorWax, DessertTopping { ... }} |
|
@@ -1068,16 +1068,16 @@ public String getPackageName() { |
|
|
* is the {@code Class} object that represents interface |
|
|
* {@code DessertTopping}. |
|
|
* |
|
|
* <p>If this object represents an interface, the array contains objects |
|
|
* <p>If this {@code Class} object represents an interface, the array contains objects |
|
|
* representing all interfaces directly extended by the interface. The |
|
|
* order of the interface objects in the array corresponds to the order of |
|
|
* the interface names in the {@code extends} clause of the declaration of |
|
|
* the interface represented by this object. |
|
|
* the interface represented by this {@code Class} object. |
|
|
* |
|
|
* <p>If this object represents a class or interface that implements no |
|
|
* <p>If this {@code Class} object represents a class or interface that implements no |
|
|
* interfaces, the method returns an array of length 0. |
|
|
* |
|
|
* <p>If this object represents a primitive type or void, the method |
|
|
* <p>If this {@code Class} object represents a primitive type or void, the method |
|
|
* returns an array of length 0. |
|
|
* |
|
|
* <p>If this {@code Class} object represents an array type, the |
|
@@ -1112,7 +1112,7 @@ public String getPackageName() { |
|
|
/** |
|
|
* Returns the {@code Type}s representing the interfaces |
|
|
* directly implemented by the class or interface represented by |
|
|
* this object. |
|
|
* this {@code Class} object. |
|
|
* |
|
|
* <p>If a superinterface is a parameterized type, the |
|
|
* {@code Type} object returned for it must accurately reflect |
|
@@ -1123,22 +1123,22 @@ public String getPackageName() { |
|
|
* for the semantics of the creation process for parameterized |
|
|
* types. |
|
|
* |
|
|
* <p>If this object represents a class, the return value is an array |
|
|
* <p>If this {@code Class} object represents a class, the return value is an array |
|
|
* containing objects representing all interfaces directly implemented by |
|
|
* the class. The order of the interface objects in the array corresponds |
|
|
* to the order of the interface names in the {@code implements} clause of |
|
|
* the declaration of the class represented by this object. |
|
|
* the declaration of the class represented by this {@code Class} object. |
|
|
* |
|
|
* <p>If this object represents an interface, the array contains objects |
|
|
* <p>If this {@code Class} object represents an interface, the array contains objects |
|
|
* representing all interfaces directly extended by the interface. The |
|
|
* order of the interface objects in the array corresponds to the order of |
|
|
* the interface names in the {@code extends} clause of the declaration of |
|
|
* the interface represented by this object. |
|
|
* the interface represented by this {@code Class} object. |
|
|
* |
|
|
* <p>If this object represents a class or interface that implements no |
|
|
* <p>If this {@code Class} object represents a class or interface that implements no |
|
|
* interfaces, the method returns an array of length 0. |
|
|
* |
|
|
* <p>If this object represents a primitive type or void, the method |
|
|
* <p>If this {@code Class} object represents a primitive type or void, the method |
|
|
* returns an array of length 0. |
|
|
* |
|
|
* <p>If this {@code Class} object represents an array type, the |
|
@@ -1196,10 +1196,10 @@ public String getPackageName() { |
|
|
* <p> If the underlying class is an array class, then its |
|
|
* {@code public}, {@code private} and {@code protected} |
|
|
* modifiers are the same as those of its component type. If this |
|
|
* {@code Class} represents a primitive type or void, its |
|
|
* {@code Class} object represents a primitive type or void, its |
|
|
* {@code public} modifier is always {@code true}, and its |
|
|
* {@code protected} and {@code private} modifiers are always |
|
|
* {@code false}. If this object represents an array class, a |
|
|
* {@code false}. If this {@code Class} object represents an array class, a |
|
|
* primitive type or void, then its {@code final} modifier is always |
|
|
* {@code true} and its interface modifier is always |
|
|
* {@code false}. The values of its other modifiers are not determined |
|
@@ -1220,7 +1220,7 @@ public String getPackageName() { |
|
|
* Gets the signers of this class. |
|
|
* |
|
|
* @return the signers of this class, or null if there are no signers. In |
|
|
* particular, this method returns null if this object represents |
|
|
* particular, this method returns null if this {@code Class} object represents |
|
|
* a primitive type or void. |
|
|
* @since 1.1 |
|
|
*/ |
|
@@ -1972,7 +1972,7 @@ private boolean hasEnclosingMethodInfo() { |
|
|
* simple name of the desired field. |
|
|
* |
|
|
* <p> The field to be reflected is determined by the algorithm that |
|
|
* follows. Let C be the class or interface represented by this object: |
|
|
* follows. Let C be the class or interface represented by this {@code Class} object: |
|
|
* |
|
|
* <OL> |
|
|
* <LI> If C declares a public field with the name specified, that is the |
|
@@ -2657,9 +2657,9 @@ public Method getDeclaredMethod(String name, Class<?>... parameterTypes) |
|
|
* <p> Otherwise, if this class is not in a named module then the rules for |
|
|
* searching resources associated with a given class are implemented by the |
|
|
* defining {@linkplain ClassLoader class loader} of the class. This method |
|
|
* delegates to this object's class loader. If this object was loaded by |
|
|
* the bootstrap class loader, the method delegates to {@link |
|
|
* ClassLoader#getSystemResourceAsStream}. |
|
|
* delegates to this {@code Class} object's class loader. |
|
|
* If this {@code Class} object was loaded by the bootstrap class loader, |
|
|
* the method delegates to {@link ClassLoader#getSystemResourceAsStream}. |
|
|
* |
|
|
* <p> Before delegation, an absolute resource name is constructed from the |
|
|
* given resource name using this algorithm: |
|
@@ -2755,9 +2755,9 @@ public InputStream getResourceAsStream(String name) { |
|
|
* <p> Otherwise, if this class is not in a named module then the rules for |
|
|
* searching resources associated with a given class are implemented by the |
|
|
* defining {@linkplain ClassLoader class loader} of the class. This method |
|
|
* delegates to this object's class loader. If this object was loaded by |
|
|
* the bootstrap class loader, the method delegates to {@link |
|
|
* ClassLoader#getSystemResource}. |
|
|
* delegates to this {@code Class} object's class loader. |
|
|
* If this {@code Class} object was loaded by the bootstrap class loader, |
|
|
* the method delegates to {@link ClassLoader#getSystemResource}. |
|
|
* |
|
|
* <p> Before delegation, an absolute resource name is constructed from the |
|
|
* given resource name using this algorithm: |
|
@@ -3658,8 +3658,8 @@ private static ReflectionFactory getReflectionFactory() { |
|
|
* Class object does not represent an enum type. |
|
|
* |
|
|
* @return an array containing the values comprising the enum class |
|
|
* represented by this Class object in the order they're |
|
|
* declared, or null if this Class object does not |
|
|
* represented by this {@code Class} object in the order they're |
|
|
* declared, or null if this {@code Class} object does not |
|
|
* represent an enum type |
|
|
* @since 1.5 |
|
|
*/ |
|
@@ -3752,7 +3752,7 @@ private String cannotCastMsg(Object obj) { |
|
|
* Casts this {@code Class} object to represent a subclass of the class |
|
|
* represented by the specified class object. Checks that the cast |
|
|
* is valid, and throws a {@code ClassCastException} if it is not. If |
|
|
* this method succeeds, it always returns a reference to this class object. |
|
|
* this method succeeds, it always returns a reference to this {@code Class} object. |
|
|
* |
|
|
* <p>This method is useful when a client needs to "narrow" the type of |
|
|
* a {@code Class} object to pass it to an API that restricts the |
|
@@ -3761,8 +3761,8 @@ private String cannotCastMsg(Object obj) { |
|
|
* could not be checked at runtime (because generic types are implemented |
|
|
* by erasure). |
|
|
* |
|
|
* @param <U> the type to cast this class object to |
|
|
* @param clazz the class of the type to cast this class object to |
|
|
* @param <U> the type to cast this {@code Class} object to |
|
|
* @param clazz the class of the type to cast this {@code Class} object to |
|
|
* @return this {@code Class} object, cast to represent a subclass of |
|
|
* the specified class object. |
|
|
* @throws ClassCastException if this {@code Class} object does not |
|
|