# Parameter

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/java/lang/reflect/Parameter#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/lang/reflect/Parameter#inhmethods)  

# Parameter

`
public

final

class
Parameter
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[AnnotatedElement](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement)`


`

|---|-----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.lang.reflect.Parameter |

<br />

*** ** * ** ***

Information about method parameters. A`Parameter`provides information about method parameters, including its name and modifiers. It also provides an alternate means of obtaining attributes for the parameter.

## Summary

|                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                 | ` `[equals](https://developer.android.com/reference/java/lang/reflect/Parameter#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Compares based on the executable and the index.                                                                                                                                                 |
| ` <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T`   | ` `[getAnnotation](https://developer.android.com/reference/java/lang/reflect/Parameter#getAnnotation(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation for the specified type if such an annotation is*present*, else null.                                                             |
| ` `[Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation)                 | ` `[getAnnotations](https://developer.android.com/reference/java/lang/reflect/Parameter#getAnnotations())`() ` Returns annotations that are*present*on this element.                                                                                                                                                                                                                   |
| ` <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T[]` | ` `[getAnnotationsByType](https://developer.android.com/reference/java/lang/reflect/Parameter#getAnnotationsByType(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns annotations that are*associated*with this element.                                                                                           |
| ` <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T`   | ` `[getDeclaredAnnotation](https://developer.android.com/reference/java/lang/reflect/Parameter#getDeclaredAnnotation(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation for the specified type if such an annotation is*directly present*, else null.                                    |
| ` `[Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation)                 | ` `[getDeclaredAnnotations](https://developer.android.com/reference/java/lang/reflect/Parameter#getDeclaredAnnotations())`() ` Returns annotations that are*directly present*on this element.                                                                                                                                                                                          |
| ` <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T[]` | ` `[getDeclaredAnnotationsByType](https://developer.android.com/reference/java/lang/reflect/Parameter#getDeclaredAnnotationsByType(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation(s) for the specified type if such annotations are either*directly present* or*indirectly present*. |
| ` `[Executable](https://developer.android.com/reference/java/lang/reflect/Executable)                      | ` `[getDeclaringExecutable](https://developer.android.com/reference/java/lang/reflect/Parameter#getDeclaringExecutable())`() ` Return the`Executable`which declares this parameter.                                                                                                                                                                                                    |
| ` int`                                                                                                     | ` `[getModifiers](https://developer.android.com/reference/java/lang/reflect/Parameter#getModifiers())`() ` Get the modifier flags for this the parameter represented by this`Parameter`object.                                                                                                                                                                                         |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                      | ` `[getName](https://developer.android.com/reference/java/lang/reflect/Parameter#getName())`() ` Returns the name of the parameter.                                                                                                                                                                                                                                                    |
| ` `[Type](https://developer.android.com/reference/java/lang/reflect/Type)                                  | ` `[getParameterizedType](https://developer.android.com/reference/java/lang/reflect/Parameter#getParameterizedType())`() ` Returns a`Type`object that identifies the parameterized type for the parameter represented by this`Parameter`object.                                                                                                                                        |
| ` `[Class](https://developer.android.com/reference/java/lang/Class)`<?>`                                   | ` `[getType](https://developer.android.com/reference/java/lang/reflect/Parameter#getType())`() ` Returns a`Class`object that identifies the declared type for the parameter represented by this`Parameter`object.                                                                                                                                                                      |
| ` int`                                                                                                     | ` `[hashCode](https://developer.android.com/reference/java/lang/reflect/Parameter#hashCode())`() ` Returns a hash code based on the executable's hash code and the index.                                                                                                                                                                                                              |
| ` boolean`                                                                                                 | ` `[isImplicit](https://developer.android.com/reference/java/lang/reflect/Parameter#isImplicit())`() ` Returns`true`if this parameter is implicitly declared in source code; returns`false`otherwise.                                                                                                                                                                                  |
| ` boolean`                                                                                                 | ` `[isNamePresent](https://developer.android.com/reference/java/lang/reflect/Parameter#isNamePresent())`() ` Returns true if the parameter has a name; returns false otherwise.                                                                                                                                                                                                        |
| ` boolean`                                                                                                 | ` `[isSynthetic](https://developer.android.com/reference/java/lang/reflect/Parameter#isSynthetic())`() ` Returns`true`if this parameter is neither implicitly nor explicitly declared in source code; returns`false`otherwise.                                                                                                                                                         |
| ` boolean`                                                                                                 | ` `[isVarArgs](https://developer.android.com/reference/java/lang/reflect/Parameter#isVarArgs())`() ` Returns`true`if this parameter represents a variable argument list; returns`false`otherwise.                                                                                                                                                                                      |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                      | ` `[toString](https://developer.android.com/reference/java/lang/reflect/Parameter#toString())`() ` Returns a string describing this parameter.                                                                                                                                                                                                                                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.lang.reflect.AnnotatedElement](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement)` ` |--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T`  | ` `[getAnnotation](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getAnnotation(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation for the specified type if such an annotation is*present*, else null.                                                                                                                                               | | ` abstract `[Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation)                | ` `[getAnnotations](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getAnnotations())`() ` Returns annotations that are*present*on this element.                                                                                                                                                                                                                                                                                                     | | ` default <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T[]` | ` `[getAnnotationsByType](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getAnnotationsByType(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns annotations that are*associated*with this element.                                                                                                                                                                             | | ` default <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T`   | ` `[getDeclaredAnnotation](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getDeclaredAnnotation(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation for the specified type if such an annotation is*directly present*, else null.                                                                                                                      | | ` abstract `[Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation)                | ` `[getDeclaredAnnotations](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getDeclaredAnnotations())`() ` Returns annotations that are*directly present*on this element.                                                                                                                                                                                                                                                                            | | ` default <T extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> T[]` | ` `[getDeclaredAnnotationsByType](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getDeclaredAnnotationsByType(java.lang.Class<T>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> annotationClass) ` Returns this element's annotation(s) for the specified type if such annotations are either*directly present* or*indirectly present*.                                                                                   | | ` default boolean`                                                                                                 | ` `[isAnnotationPresent](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#isAnnotationPresent(java.lang.Class<?%20extends%20java.lang.annotation.Annotation>))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<? extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`> annotationClass) ` Returns true if an annotation for the specified type is*present*on this element, else false. | ||

## Public methods

### equals

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean equals (Object obj)
```

Compares based on the executable and the index.

<br />

|                   Parameters                   ||
|-------|-----------------------------------------|
| `obj` | `Object`: The object to compare. <br /> |

|                             Returns                             ||
|-----------|------------------------------------------------------|
| `boolean` | Whether or not this is equal to the argument. <br /> |

### getAnnotation

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T getAnnotation (Class<T> annotationClass)
```

Returns this element's annotation for the specified type if such an annotation is*present*, else null.

<br />

|                                        Parameters                                        ||
|-------------------|-----------------------------------------------------------------------|
| `annotationClass` | `Class`: the Class object corresponding to the annotation type <br /> |

|                                                    Returns                                                    ||
|-----|----------------------------------------------------------------------------------------------------------|
| `T` | this element's annotation for the specified annotation type if present on this element, else null <br /> |

|                                              Throws                                               ||
|------------------------------------------------------------------------------------------------|---|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) |   |

### getAnnotations

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Annotation[] getAnnotations ()
```

Returns annotations that are*present* on this element. If there are no annotations*present*on this element, the return value is an array of length 0. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

<br />

|                                                               Returns                                                               ||
|-----------------------------------------------------------------------------------------|--------------------------------------------|
| [Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation) | annotations present on this element <br /> |

### getAnnotationsByType

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T[] getAnnotationsByType (Class<T> annotationClass)
```

Returns annotations that are*associated* with this element. If there are no annotations*associated* with this element, the return value is an array of length 0. The difference between this method and[getAnnotation(java.lang.Class)](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getAnnotation(java.lang.Class<T>))is that this method detects if its argument is a*repeatable annotation type*(JLS 9.6), and if so, attempts to find one or more annotations of that type by "looking through" a container annotation. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

<br />

|                                        Parameters                                        ||
|-------------------|-----------------------------------------------------------------------|
| `annotationClass` | `Class`: the Class object corresponding to the annotation type <br /> |

|                                                                   Returns                                                                    ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------|
| `T[]` | all this element's annotations for the specified annotation type if associated with this element, else an array of length zero <br /> |

|                                              Throws                                               ||
|------------------------------------------------------------------------------------------------|---|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) |   |

### getDeclaredAnnotation

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T getDeclaredAnnotation (Class<T> annotationClass)
```

Returns this element's annotation for the specified type if such an annotation is*directly present*, else null. This method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)

<br />

|                                        Parameters                                        ||
|-------------------|-----------------------------------------------------------------------|
| `annotationClass` | `Class`: the Class object corresponding to the annotation type <br /> |

|                                                        Returns                                                         ||
|-----|-------------------------------------------------------------------------------------------------------------------|
| `T` | this element's annotation for the specified annotation type if directly present on this element, else null <br /> |

|                                              Throws                                               ||
|------------------------------------------------------------------------------------------------|---|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) |   |

### getDeclaredAnnotations

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Annotation[] getDeclaredAnnotations ()
```

Returns annotations that are*directly present* on this element. This method ignores inherited annotations. If there are no annotations*directly present*on this element, the return value is an array of length 0. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

<br />

|                                                                   Returns                                                                    ||
|-----------------------------------------------------------------------------------------|-----------------------------------------------------|
| [Annotation[]](https://developer.android.com/reference/java/lang/annotation/Annotation) | annotations directly present on this element <br /> |

### getDeclaredAnnotationsByType

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public T[] getDeclaredAnnotationsByType (Class<T> annotationClass)
```

Returns this element's annotation(s) for the specified type if such annotations are either*directly present* or*indirectly present* . This method ignores inherited annotations. If there are no specified annotations directly or indirectly present on this element, the return value is an array of length 0. The difference between this method and[getDeclaredAnnotation(java.lang.Class)](https://developer.android.com/reference/java/lang/reflect/AnnotatedElement#getDeclaredAnnotation(java.lang.Class<T>))is that this method detects if its argument is a*repeatable annotation type*(JLS 9.6), and if so, attempts to find one or more annotations of that type by "looking through" a container annotation if one is present. The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

<br />

|                                        Parameters                                        ||
|-------------------|-----------------------------------------------------------------------|
| `annotationClass` | `Class`: the Class object corresponding to the annotation type <br /> |

|                                                                            Returns                                                                             ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `T[]` | all this element's annotations for the specified annotation type if directly or indirectly present on this element, else an array of length zero <br /> |

|                                              Throws                                               ||
|------------------------------------------------------------------------------------------------|---|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) |   |

### getDeclaringExecutable

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Executable getDeclaringExecutable ()
```

Return the`Executable`which declares this parameter.

<br />

|                                                               Returns                                                               ||
|------------------------------------------------------------------------------------|-------------------------------------------------|
| [Executable](https://developer.android.com/reference/java/lang/reflect/Executable) | The`Executable`declaring this parameter. <br /> |

### getModifiers

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getModifiers ()
```

Get the modifier flags for this the parameter represented by this`Parameter`object.

<br />

|                       Returns                        ||
|-------|-----------------------------------------------|
| `int` | The modifier flags for this parameter. <br /> |

### getName

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getName ()
```

Returns the name of the parameter. If the parameter's name is[present](https://developer.android.com/reference/java/lang/reflect/Parameter#isNamePresent()), then this method returns the name provided by the class file. Otherwise, this method synthesizes a name of the form argN, where N is the index of the parameter in the descriptor of the method which declares the parameter.

<br />

|                                                                                              Returns                                                                                              ||
|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The name of the parameter, either provided by the class file or synthesized if the class file does not provide a name. <br /> |

### getParameterizedType

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Type getParameterizedType ()
```

Returns a`Type`object that identifies the parameterized type for the parameter represented by this`Parameter`object.

<br />

|                                                                                   Returns                                                                                   ||
|------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| [Type](https://developer.android.com/reference/java/lang/reflect/Type) | a`Type`object identifying the parameterized type of the parameter represented by this object <br /> |

### getType

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Class<?> getType ()
```

Returns a`Class`object that identifies the declared type for the parameter represented by this`Parameter`object.

<br />

|                                                                                Returns                                                                                 ||
|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| [Class](https://developer.android.com/reference/java/lang/Class)`<?>` | a`Class`object identifying the declared type of the parameter represented by this object <br /> |

### hashCode

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int hashCode ()
```

Returns a hash code based on the executable's hash code and the index.

<br />

|                            Returns                             ||
|-------|---------------------------------------------------------|
| `int` | A hash code based on the executable's hash code. <br /> |

### isImplicit

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isImplicit ()
```

Returns`true`if this parameter is implicitly declared in source code; returns`false`otherwise.

<br />

|                                                          Returns                                                           ||
|-----------|-----------------------------------------------------------------------------------------------------------------|
| `boolean` | true if and only if this parameter is implicitly declared as defined byThe Java™ Language Specification. <br /> |

### isNamePresent

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isNamePresent ()
```

Returns true if the parameter has a name; returns false otherwise. Whether a parameter has a name is determined by compiler options and whether the parameter is synthesized.

<br />

|                            Returns                             ||
|-----------|-----------------------------------------------------|
| `boolean` | true if and only if the parameter has a name <br /> |

### isSynthetic

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isSynthetic ()
```

Returns`true`if this parameter is neither implicitly nor explicitly declared in source code; returns`false`otherwise.

<br />

|                                                           Returns                                                            ||
|-----------|-------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if and only if this parameter is a synthetic construct as defined byThe Java™ Language Specification. <br /> |

### isVarArgs

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isVarArgs ()
```

Returns`true`if this parameter represents a variable argument list; returns`false`otherwise.

<br />

|                                          Returns                                          ||
|-----------|--------------------------------------------------------------------------------|
| `boolean` | `true`if an only if this parameter represents a variable argument list. <br /> |

### toString

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns a string describing this parameter. The format is the modifiers for the parameter, if any, in canonical order as recommended byThe Java™ Language Specification, followed by the fully- qualified type of the parameter (excluding the last \[\] if the parameter is variable arity), followed by "..." if the parameter is variable arity, followed by a space, followed by the name of the parameter.

<br />

|                                                                     Returns                                                                     ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | A string representation of the parameter and associated information. <br /> |