code: public static boolean isValid(AnnotationDefinition annoDef, String value)
              throws PatternSyntaxException {
          if (annoDef == null) {
              throw new InvalidArgument("annoDef", annoDef);
          }
          if (annoDef.getType() == null) {
              return false;
          }
          switch (annoDef.getType()) {
          case ENUMERATION:
              return validateEnumeration(annoDef.getEnums(), value);
          case REGULAR_EXPRESSION:
              return validateRegExp(annoDef.getValue(), value);
          default:
              return false;
          }
      }
docs: Determine if the given value is valid as defined by the specified
  {@link AnnotationDefinition}. A valid value is one that is valid for the
  specified domain of the {@link AnnotationDefinition}.
  
  @param annoDef
  a <code>non-null</code> {@link AnnotationDefinition}. Although
  the {@link AnnotationType} of the annoDef may be null, this
  method will always evaluate to <code>false</code> in such a
  case.
  @param value
  the value to validate, possibly <code>null</code>
  @return whether the given value is valid as defined by the given
  {@link AnnotationDefinition}
  @throws PatternSyntaxException
  if the {@link AnnotationDefinition} used by the
  {@link Annotation} is of type
  {@value AnnotationType#REGULAR_EXPRESSION} and the specified
  pattern is invalid.
  @throws InvalidArgument
  Thrown if the <tt>annoDef</tt> argument isnull