public final class Parameter extends Object implements AnnotatedElement
Parameter
提供方法的参数信息,包括其名称和改性剂。它还提供了一个获取参数的属性的替代方法。
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
基于可执行文件和索引的比较。
|
AnnotatedType |
getAnnotatedType()
返回一个annotatedtype对象表示类型来指定这个参数表示的形式参数的类型的使用。
|
<T extends Annotation> |
getAnnotation(类<T> annotationClass)
如果存在此注释,则返回此元素的指定类型的注释,否则为空。
|
Annotation[] |
getAnnotations()
返回此元素上的注释。
|
<T extends Annotation> |
getAnnotationsByType(类<T> annotationClass)
返回与此元素关联的注释。
|
<T extends Annotation> |
getDeclaredAnnotation(类<T> annotationClass)
返回此元素的指定类型的注释,如果这样的注释是直接存在的,否则为空。
|
Annotation[] |
getDeclaredAnnotations()
返回直接在该元素上的注释。
|
<T extends Annotation> |
getDeclaredAnnotationsByType(类<T> annotationClass)
如果这样的注释直接存在或间接存在,则返回指定类型的该元素的注释(s)。
|
Executable |
getDeclaringExecutable()
返回
Executable 声明该参数。
|
int |
getModifiers()
得到这个参数的
Parameter 对象表示的修饰符标记。
|
String |
getName()
返回参数的名称。
|
Type |
getParameterizedType()
返回一个
Type 对象标识的参数化类型的
Parameter 对象表示的参数。
|
类<?> |
getType()
返回一个
类 对象标识声明类型的
Parameter 对象表示的参数。
|
int |
hashCode()
返回基于可执行的哈希代码和索引的哈希代码。
|
boolean |
isImplicit()
返回
true 如果这个参数是隐式声明的源代码;否则返回
false 。
|
boolean |
isNamePresent()
如果参数根据类文件有一个名称,则返回真;否则返回错误。
|
boolean |
isSynthetic()
返回
true 如果这个参数是不隐式或显式声明的源代码;否则返回
false 。
|
boolean |
isVarArgs()
返回
true 如果这个参数是一个可变参数列表;否则返回
false 。
|
String |
toString()
返回描述此参数的字符串。
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isAnnotationPresent
public boolean equals(Object obj)
equals
方法重写,继承类
Object
obj
-比较对象。
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean isNamePresent()
public String toString()
public Executable getDeclaringExecutable()
Executable
声明该参数。
Executable
声明该参数。
public int getModifiers()
Parameter
对象表示的修饰符标记。
public String getName()
public Type getParameterizedType()
Type
对象标识的参数化类型的
Parameter
对象表示的参数。
Type
对象识别该对象表示的参数化类型
public 类<?> getType()
类
对象标识声明类型的
Parameter
对象表示的参数。
类
对象标识声明的类型该对象表示的参数
public AnnotatedType getAnnotatedType()
AnnotatedType
对象代表一个类型来指定这个参数表示的形式参数的类型的使用
public boolean isImplicit()
true
如果这个参数是隐式声明的源代码;否则返回
false
。
public boolean isSynthetic()
true
如果这个参数是不隐式或显式声明的源代码;否则返回
false
。
public boolean isVarArgs()
true
如果这个参数是一个可变参数列表;否则返回
false
。
true
如果只有如果这个参数是一个可变参数列表。
public <T extends Annotation> T getAnnotation(类<T> annotationClass)
getAnnotation
接口
AnnotatedElement
T
-查询并返回如果目前的标注类型
annotationClass
-对应的注释类型的类对象
NullPointerException
如果注释类是无效的
public <T extends Annotation> T[] getAnnotationsByType(类<T> annotationClass)
AnnotatedElement.getAnnotation(Class)
之间的区别是,该方法检测如果它的参数是一个可重复的注释类型(年9.6),如果是这样的话,试图找到一个或更多的注释,通过“浏览”式容器标注。此方法的调用方可以自由修改返回的数组;它将对返回给其他调用方的数组没有影响。
getAnnotationsByType
接口
AnnotatedElement
T
-查询并返回如果目前的标注类型
annotationClass
-对应的注释类型的类对象
NullPointerException
如果注释类是无效的
public Annotation[] getDeclaredAnnotations()
getDeclaredAnnotations
接口
AnnotatedElement
public <T extends Annotation> T getDeclaredAnnotation(类<T> annotationClass)
AnnotatedElement
getDeclaredAnnotation
接口
AnnotatedElement
T
-查询,如果直接提出返回的标注类型
annotationClass
-对应的注释类型的类对象
NullPointerException
如果注释类是无效的
public <T extends Annotation> T[] getDeclaredAnnotationsByType(类<T> annotationClass)
AnnotatedElement
AnnotatedElement.getDeclaredAnnotation(Class)
之间的区别是,该方法检测如果它的参数是一个可重复的注释类型(年9.6),如果是这样的话,试图找到一个或更多的注释,通过“浏览”式容器注释如果存在。此方法的调用方可以自由修改返回的数组;它将对返回给其他调用方的数组没有影响。
getDeclaredAnnotationsByType
接口
AnnotatedElement
T
-注释类型来查询并返回如果直接或间接存在
annotationClass
-对应的注释类型的类对象
NullPointerException
如果注释类是无效的
public Annotation[] getAnnotations()
getAnnotations
接口
AnnotatedElement
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.