org.apache.commons.attributes
Class Target

java.lang.Object
  extended byorg.apache.commons.attributes.Target

public class Target
extends Object

Attribute indicating what elements an attribute may be applied to. This is checked at runtime. If the attribute is absent, it defaults to 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 { ... }
 

Since:
2.1

Field Summary
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.
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 Summary
Target(int flags)
          Creates a new target attribute.
 
Method Summary
 int getFlags()
          Returns an int that is the bitwise or of the allowed target flags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS

public static final int CLASS
Indicates that the attribute can be applied to a class or interface.

Since:
2.1
See Also:
Constant Field Values

FIELD

public static final int FIELD
Indicates that the attribute can be applied to a field.

Since:
2.1
See Also:
Constant Field Values

METHOD

public static final int METHOD
Indicates that the attribute can be applied to a method.

Since:
2.1
See Also:
Constant Field Values

CONSTRUCTOR

public static final int CONSTRUCTOR
Indicates that the attribute can be applied to a constructor.

Since:
2.1
See Also:
Constant Field Values

METHOD_PARAMETER

public static final int METHOD_PARAMETER
Indicates that the attribute can be applied to a method parameter.

Since:
2.1
See Also:
Constant Field Values

CONSTRUCTOR_PARAMETER

public static final int CONSTRUCTOR_PARAMETER
Indicates that the attribute can be applied to a constructor parameter.

Since:
2.1
See Also:
Constant Field Values

RETURN

public static final int RETURN
Indicates that the attribute can be applied to a method return value.

Since:
2.1
See Also:
Constant Field Values

PARAMETER

public static final int PARAMETER
Indicates that the attribute can be applied to a parameter of a method or a constructor. It is equal to METHOD_PARAMETER | CONSTRUCTOR_PARAMETER.

Since:
2.1
See Also:
Constant Field Values

ALL

public static final int ALL
Indicates that the attribute can be applied to any program element.

Since:
2.1
See Also:
Constant Field Values
Constructor Detail

Target

public Target(int flags)
Creates a new target attribute.

Parameters:
flags - a bitwise or of flags indicating the allowed targets.
Since:
2.1
Method Detail

getFlags

public int getFlags()
Returns an int that is the bitwise or of the allowed target flags.

Since:
2.1


Copyright © The Apache Software Foundation. All Rights Reserved.