-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: validator annotations trigger "variable not found"
PostPosted: Sat Apr 12, 2014 1:58 am 
Newbie

Joined: Sat Apr 12, 2014 1:55 am
Posts: 2
This is a total newb question. I was trying to write a validator...used some annotations like:

@Target({value=TYPE, ANNOTATION_TYPE})
@Retention(value=RUNTIME)

...and my IDE is giving me errors on those lines, saying "Retention" cannot be resolved to a type and such.

I'm sure this is super simple, maybe a dependency in a pom..

any help is much appreciated


Top
 Profile  
 
 Post subject: Re: validator annotations trigger "variable not found"
PostPosted: Sat Apr 12, 2014 2:12 am 
Newbie

Joined: Sat Apr 12, 2014 1:55 am
Posts: 2
psyncho wrote:
This is a total newb question. I was trying to write a validator...used some annotations like:

@Target({value=TYPE, ANNOTATION_TYPE})
@Retention(value=RUNTIME)

...and my IDE is giving me errors on those lines, saying "Retention" cannot be resolved to a type and such.

I'm sure this is super simple, maybe a dependency in a pom..

any help is much appreciated


O.k., with the proper imports this seemed to work (not sure why the documentation omits this)

import java.lang.annotation.Documented;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Retention;

import javax.validation.Constraint;
import javax.validation.Payload;


@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.