# Target

public abstract @interface **Target** implements [Annotation](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html) Indicates the contexts in which an annotation type is applicable. The
declaration contexts and type contexts in which an annotation type may be
applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
constants of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/ElementType.html`.

If an `@Target` meta-annotation is not present on an annotation type
`T` , then an annotation of type `T` may be written as a
modifier for any declaration except a type parameter declaration.

If an `@Target` meta-annotation is present, the compiler will enforce
the usage restrictions indicated by `ElementType`
enum constants, in line with JLS 9.7.4.

For example, this `@Target` meta-annotation indicates that the
declared type is itself a meta-annotation type. It can only be used on
annotation type declarations:

```
    @Target(ElementType.ANNOTATION_TYPE)
    public @interface MetaAnnotationType {
        ...
    }
 
```

This `@Target` meta-annotation indicates that the declared type is
intended solely for use as a member type in complex annotation type
declarations. It cannot be used to annotate anything directly:

```
    @Target({})
    public @interface MemberType {
        ...
    }
 
```

It is a compile-time error for a single `ElementType` constant to
appear more than once in an `@Target` annotation. For example, the
following `@Target` meta-annotation is illegal:

```
    @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
    public @interface Bogus {
        ...
    }
 
```

<br />

### Public Method Summary

|---|---|
| [ElementType\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/ElementType.html) | [value](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Target.html#value())() Returns an array of the kinds of elements an annotation type can be applied to. |

### Inherited Method Summary

From interface [java.lang.annotation.Annotation](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html)

|---|---|
| abstract [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<? extends [Annotation](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html)\> | [annotationType](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html#annotationType())() Returns the annotation type of this annotation. |
| abstract boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Returns true if the specified object represents an annotation that is logically equivalent to this one. |
| abstract int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html#hashCode())() Returns the hash code of this annotation, as defined below: The hash code of an annotation is the sum of the hash codes of its members (including those with default values), as defined below: The hash code of an annotation member is (127 times the hash code of the member-name as computed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html#hashCode()`) XOR the hash code of the member-value, as defined below: The hash code of a member-value depends on its type: - The hash code of a primitive value *v* is equal to *WrapperType*.valueOf(*v*).hashCode(), where *WrapperType* is the wrapper type corresponding to the primitive type of *v* (`https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Byte.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Double.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Float.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Integer.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Short.html`, or `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Boolean.html`). |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/Annotation.html#toString())() Returns a string representation of this annotation. |

## Public Methods

#### public [ElementType\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/ElementType.html)
**value**
()

Returns an array of the kinds of elements an annotation type
can be applied to.

##### Returns

- an array of the kinds of elements an annotation type can be applied to