public class JAnnotationUse extends AbstractJAnnotationValueOwned
AbstractJAnnotationValueOwned.FullClassNameExpr, AbstractJAnnotationValueOwned.JEnumConstantExpr
Modifier and Type | Field and Description |
---|---|
static String |
SPECIAL_KEY_VALUE
The special parameter name that can be optimized away if used without any
other parameter
|
Constructor and Description |
---|
JAnnotationUse(AbstractJClass aAnnotationClass) |
Modifier and Type | Method and Description |
---|---|
JAnnotationUse |
annotationParam(String name,
AbstractJClass value)
Adds a member value pair to this annotation For adding class values as
param
|
JAnnotationUse |
annotationParam(String name,
Class<? extends Annotation> value)
Adds a member value pair to this annotation For adding class values as
param
|
void |
generate(JFormatter f) |
AbstractJClass |
getAnnotationClass() |
Map<String,AbstractJAnnotationValue> |
getAnnotationMembers() |
JAnnotationStringValue |
getConstantParam(String sName) |
IJExpression |
getConstantParamValue(String sName) |
AbstractJAnnotationValue |
getParam(String sName) |
<T> T |
getParam(String sName,
Class<T> klass)
Return annotation argument represented as required type.
|
boolean |
hasAnnotationMembers() |
JCodeModel |
owner()
Gets the owner code model object.
|
JAnnotationUse |
param(String name,
AbstractJType type)
Adds a member value pair to this annotation based on the type represented
by the given
AbstractJType |
JAnnotationUse |
param(String sName,
boolean value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
byte value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
char value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
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<?
|
JAnnotationUse |
param(String name,
double value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
Enum<?> value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
float value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
IJExpression value)
Adds a member value pair to this annotation.
|
JAnnotationUse |
param(String name,
int value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
JEnumConstant value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
long value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
short value)
Adds a member value pair to this annotation
|
JAnnotationUse |
param(String name,
String value)
Adds a member value pair to this annotation
|
JAnnotationArrayMember |
paramArray(String sName)
Adds a member value pair which is of type array to this annotation
|
JAnnotationUse |
paramArray(String name,
AbstractJType... values) |
JAnnotationUse |
paramArray(String name,
boolean... values) |
JAnnotationUse |
paramArray(String name,
byte... values) |
JAnnotationUse |
paramArray(String name,
char... values) |
JAnnotationUse |
paramArray(String name,
Class<?>... values) |
JAnnotationUse |
paramArray(String name,
double... values) |
JAnnotationUse |
paramArray(String name,
Enum<?>... values) |
JAnnotationUse |
paramArray(String name,
float... values) |
JAnnotationUse |
paramArray(String name,
IJExpression... values) |
JAnnotationUse |
paramArray(String name,
int... values) |
JAnnotationUse |
paramArray(String name,
JEnumConstant... values) |
JAnnotationUse |
paramArray(String name,
long... values) |
JAnnotationUse |
paramArray(String name,
short... values) |
JAnnotationUse |
paramArray(String name,
String... values) |
int |
size() |
wrap, wrap
public static final String SPECIAL_KEY_VALUE
public JAnnotationUse(@Nonnull AbstractJClass aAnnotationClass)
@Nonnull public AbstractJClass getAnnotationClass()
@Nonnull public JCodeModel owner()
IJOwned
null
.@Nonnull public Map<String,AbstractJAnnotationValue> getAnnotationMembers()
public boolean hasAnnotationMembers()
@Nullable public AbstractJAnnotationValue getParam(@Nullable String sName)
@Nullable public <T> T getParam(@Nonnull String sName, @Nonnull Class<T> klass) throws ClassCastException
For example, you can have annotation parameter named 'value' of type String.
You can write getParam("value", String.class)
to get raw
string-value. You can write
getParam("value", AbstractJAnnotationValue.class)
to get
AbstractJAnnotationValue for this argument.
Arrays are supported as a result type.
T
- return typesName
- annotation parameter nameklass
- type to use as a return typeClassCastException
@Nullable public JAnnotationStringValue getConstantParam(@Nullable String sName)
@Nullable public IJExpression getConstantParamValue(@Nullable String sName)
@Nonnull public JAnnotationUse param(@Nonnull String sName, boolean value)
sName
- The simple name for this annotationvalue
- The boolean value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull boolean... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, byte value)
name
- The simple name for this annotationvalue
- The byte member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull byte... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, char value)
name
- The simple name for this annotationvalue
- The char member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull char... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, double value)
name
- The simple name for this annotationvalue
- The double member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull double... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, float value)
name
- The simple name for this annotationvalue
- The float member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull float... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, long value)
name
- The simple name for this annotationvalue
- The long member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull long... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, short value)
name
- The simple name for this annotationvalue
- The short member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull short... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, int value)
name
- The simple name for this annotationvalue
- The int member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull int... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, String value)
name
- The simple name for this annotationvalue
- The String member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull String... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, @Nonnull Enum<?> value)
name
- The simple name for this annotationvalue
- The enum class which is member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull Enum<?>... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, @Nonnull JEnumConstant value)
name
- The simple name for this annotationvalue
- The JEnumConstant
which is member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull JEnumConstant... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, @Nonnull Class<?> value)
@XmlCollectionItem(type=Integer.class);For adding a value of Class<? extends Annotation>
annotationParam(String, Class)
name
- The simple name for this annotation paramvalue
- The class type of the paramJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull Class<?>... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, @Nonnull AbstractJType type)
AbstractJType
name
- The simple name for this annotation paramtype
- the AbstractJType
representing the actual typeJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull AbstractJType... values)
@Nonnull public JAnnotationUse param(@Nonnull String name, @Nonnull IJExpression value)
name
- The simple name for this annotationvalue
- The IJExpression
which provides the content value for this
annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.@Nonnull public JAnnotationUse paramArray(@Nonnull String name, @Nonnull IJExpression... values)
@Nonnull public JAnnotationArrayMember paramArray(@Nonnull String sName)
sName
- The simple name for this annotationJAnnotationArrayMember
. For adding array valuesJAnnotationArrayMember
@Nonnull public JAnnotationUse annotationParam(@Nonnull String name, @Nonnull Class<? extends Annotation> value)
name
- The simple name for this annotationvalue
- The annotation class which is member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.param(String, Class)
@Nonnull public JAnnotationUse annotationParam(@Nonnull String name, @Nonnull AbstractJClass value)
name
- The simple name for this annotationvalue
- The annotation class which is member value for this annotationJAnnotationUse
. More member value pairs can be added to
it using the same or the overloaded methods.param(String, Class)
@Nonnegative public int size()
public void generate(JFormatter f)
Copyright © 2013–2017 Philip Helger. All rights reserved.