Top Description Fields Constructors Methods
com.sun.codemodel

public final Class JAnnotationUse

extends JAnnotationValue
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.Collections, .LinkedHashMap, .Map

Represents an annotation on a program element. TODO How to add enums to the annotations
Author
Bhakti Mehta ([email protected])

Field Summary

Modifier and TypeField and Description
private final JClass
clazz

The Annotation class

private Map<String, JAnnotationValue>
memberValues

Map of member values.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
addValue(String name, JAnnotationValue annotationValue)

public JAnnotationUse

Returns:

The JAnnotationUse that can be used as a member within this JAnnotationUse
annotate
(Class<? extends Annotation>
The annotation class to be included
clazz
)

This can be used to add annotations inside annotations for e.g @XmlCollection(values= @XmlCollectionItem(type=Foo.class))

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
annotationParam
(String
The simple name for this annotation
name
,
Class<? extends Annotation>
The annotation class which is member value for this annotation
value
)

Adds a member value pair to this annotation For adding class values as param

public void
public JClass
public Map<String, JAnnotationValue>
private boolean
private JCodeModel
public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
boolean
The boolean value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
byte
The byte member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
char
The char member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
double
The double member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
float
The float member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
long
The long member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
short
The short member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
int
The int member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
String
The String member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
final Enum<?>
The enum class which is member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
JEnumConstant
The JEnumConstant which is member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation param
name
,
final Class<?>
The class type of the param
value
)

Adds a member value pair to this annotation This can be used for e.g to specify

       @XmlCollectionItem(type=Integer.class);
public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
JAnnotationValue
The JAnnotationValue member value for this annotation
value
)

Adds a member value pair to this annotation

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation param
name
,
JType
the JType representing the actual type
type
)

Adds a member value pair to this annotation based on the type represented by the given JType

public JAnnotationUse

Returns:

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.
param
(String
The simple name for this annotation
name
,
JExpression
The JExpression which provides the contant value for this annotation
value
)

Adds a member value pair to this annotation.

public JAnnotationArrayMember

Returns:

The JAnnotationArrayMember. For adding array values
paramArray
(String
The simple name for this annotation
name
)

Adds a member value pair which is of type array to this annotation

Field Detail

clazzback to summary
private final JClass clazz

The Annotation class

memberValuesback to summary
private Map<String, JAnnotationValue> memberValues

Map of member values.

Constructor Detail

JAnnotationUseback to summary
pack-priv JAnnotationUse(JClass clazz)

Method Detail

addValueback to summary
private void addValue(String name, JAnnotationValue annotationValue)
annotateback to summary
public JAnnotationUse annotate(Class<? extends Annotation> clazz)

This can be used to add annotations inside annotations for e.g @XmlCollection(values= @XmlCollectionItem(type=Foo.class))

Parameters
clazz:Class<? extends Annotation>

The annotation class to be included

Returns:JAnnotationUse

The JAnnotationUse that can be used as a member within this JAnnotationUse

Annotations
@Deprecated
annotationParamback to summary
public JAnnotationUse annotationParam(String name, Class<? extends Annotation> value)

Adds a member value pair to this annotation For adding class values as param

Parameters
name:String

The simple name for this annotation

value:Class<? extends Annotation>

The annotation class which is member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

See Also
param(String, Class)
generateback to summary
public void generate(JFormatter f)

Implements com.sun.codemodel.JGenerable.generate.

Annotations
@Override
getAnnotationClassback to summary
public JClass getAnnotationClass()
getAnnotationMembersback to summary
public Map<String, JAnnotationValue> getAnnotationMembers()
isOptimizableback to summary
private boolean isOptimizable()
ownerback to summary
private JCodeModel owner()
paramback to summary
public JAnnotationUse param(String name, boolean value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:boolean

The boolean value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, byte value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:byte

The byte member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, char value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:char

The char member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, double value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:double

The double member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, float value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:float

The float member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, long value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:long

The long member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, short value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:short

The short member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, int value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:int

The int member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, String value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:String

The String member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, final Enum<?> value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:Enum<?>

The enum class which is member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, JEnumConstant value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:JEnumConstant

The JEnumConstant which is member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, final Class<?> value)

Adds a member value pair to this annotation This can be used for e.g to specify

       @XmlCollectionItem(type=Integer.class);
For adding a value of Class<? extends Annotation> annotationParam(java.lang.String, java.lang.Class)
Parameters
name:String

The simple name for this annotation param

value:Class<?>

The class type of the param

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, JAnnotationValue value)

Adds a member value pair to this annotation

Parameters
name:String

The simple name for this annotation

value:JAnnotationValue

The JAnnotationValue member value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, JType type)

Adds a member value pair to this annotation based on the type represented by the given JType

Parameters
name:String

The simple name for this annotation param

type:JType

the JType representing the actual type

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramback to summary
public JAnnotationUse param(String name, JExpression value)

Adds a member value pair to this annotation.

Parameters
name:String

The simple name for this annotation

value:JExpression

The JExpression which provides the contant value for this annotation

Returns:JAnnotationUse

The JAnnotationUse. More member value pairs can be added to it using the same or the overloaded methods.

paramArrayback to summary
public JAnnotationArrayMember paramArray(String name)

Adds a member value pair which is of type array to this annotation

Parameters
name:String

The simple name for this annotation

Returns:JAnnotationArrayMember

The JAnnotationArrayMember. For adding array values

See Also
JAnnotationArrayMember