public class Target
extends java.lang.Object
Target.ALL
.
This attribute is intended to be used with attribute classes:
/**
* MyAttribute can only be applied to classes and fields, not methods.
* @@Target(Target.CLASS | Target.FIELD)
*/
public class MyAttribute { ... }
Modifier and Type | Field and Description |
---|---|
static int |
ALL
Indicates that the attribute can be applied to any program element.
|
static int |
CLASS
Indicates that the attribute can be applied to a class or interface.
|
static int |
CONSTRUCTOR
Indicates that the attribute can be applied to a constructor.
|
static int |
CONSTRUCTOR_PARAMETER
Indicates that the attribute can be applied to a constructor parameter.
|
static int |
FIELD
Indicates that the attribute can be applied to a field.
|
private int |
flags |
static int |
METHOD
Indicates that the attribute can be applied to a method.
|
static int |
METHOD_PARAMETER
Indicates that the attribute can be applied to a method parameter.
|
static int |
PARAMETER
Indicates that the attribute can be applied to a parameter of a method or a constructor.
|
static int |
RETURN
Indicates that the attribute can be applied to a method return value.
|
Constructor and Description |
---|
Target(int flags)
Creates a new target attribute.
|
Modifier and Type | Method and Description |
---|---|
int |
getFlags()
Returns an
int that is the bitwise or of the allowed target flags. |
public static final int CLASS
public static final int FIELD
public static final int METHOD
public static final int CONSTRUCTOR
public static final int METHOD_PARAMETER
public static final int CONSTRUCTOR_PARAMETER
public static final int RETURN
public static final int PARAMETER
METHOD_PARAMETER | CONSTRUCTOR_PARAMETER
.public static final int ALL
private final int flags