java - Checking if an annotation is of a specific type -


I am using reflection to see if any annotation is related to property of a class, a specific Is of type. Currently I am:

  if ("javax.validation.Valid" .equals (annotation.annotationType (). GetName ())) {...}  < / Pre> 

who kills me as a little litter because it depends on a string which is a fully-qualified class-name. If the name space changes in the future, then it can be the cause of subtle errors.

What I would like to do:

  if (class.formname (annotation.notation type). GetName ()) isInstance (new javax.validation.Valid ()) ) {...}  

but javax.validation.Valid is an abstract class and can not be done immediately. Is there a way to simulate the example (or basically use isInstance ) against an interface or an abstract class?

are you looking for just

  (if any If not the comment)  

?


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -