[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Adding MetaData.isAnnotationPresent(String annotationTyp

adrian@jboss.org do-not-reply at jboss.com
Wed Feb 13 06:28:59 EST 2008


It already exists:


  |    /**
  |     * Is the metadata present
  |     * 
  |     * @param name the name of the meta data
  |     * @return true when the metadata is present
  |     */
  |    boolean isMetaDataPresent(String name);
  | 

If you're not going to check whether the name is really an annotation class
then they are the same thing.

Of course, you might want to implement it like this, just to make doubly sure :-)


  | public boolean isAnnotationPresent(String name)
  | {
  |    Object test = getMetaData(name);
  |    return test != null && (test instanceof Annotation);
  | }
  | 

But such a non-annotation using the name of annotation class would break
the assumption of how the annotation stuff works in the metadata. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129078#4129078

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129078



More information about the jboss-dev-forums mailing list