[forge-issues] [JBoss JIRA] (FORGE-1671) Add nested annotation to a constraint annotation
Antonio Goncalves (JIRA)
issues at jboss.org
Wed Mar 12 16:29:10 EDT 2014
[ https://issues.jboss.org/browse/FORGE-1671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Goncalves updated FORGE-1671:
-------------------------------------
Description:
At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
{code}
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "Invalid value";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
{code}
It should add a nested annotation {{List}} of type array of constraint
{code}
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "Invalid value";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
{code}
was:
At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
{code}
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "Invalid value";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
{code}
It should add a nested annotation {{List}} of type array of constraint
@Documented
@Constraint(validatedBy = {})
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
public @interface URL {
String message() default "Invalid value";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
URL[] value();
}
}
> Add nested annotation to a constraint annotation
> ------------------------------------------------
>
> Key: FORGE-1671
> URL: https://issues.jboss.org/browse/FORGE-1671
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.1.2.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> At the moment a constraint annotation does not contain a {{List}} of constraints. So, at the moment, the command {{constraint-new-annotation}} generates the following code :
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> {code}
> It should add a nested annotation {{List}} of type array of constraint
> {code}
> @Documented
> @Constraint(validatedBy = {})
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @ReportAsSingleViolation
> public @interface URL {
> String message() default "Invalid value";
> Class<?>[] groups() default { };
> Class<? extends Payload>[] payload() default { };
> @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
> @Retention(RUNTIME)
> @Documented
> public @interface List {
> URL[] value();
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list