code: public static AnnotatedType<?> getDeclaringAnnotatedType(Annotated annotated) {
          if (annotated == null) {
              throw new IllegalArgumentException("Annotated cannot be null");
          }
          if (annotated instanceof AnnotatedType<?>) {
              return cast(annotated);
          }
          if (annotated instanceof AnnotatedMember<?>) {
              return Reflections.<AnnotatedMember<?>>cast(annotated).getDeclaringType();
          }
          if (annotated instanceof AnnotatedParameter<?>) {
              return getDeclaringAnnotatedType(Reflections.<AnnotatedParameter<?>>cast(annotated).getDeclaringCallable());
          }
          throw new IllegalArgumentException("Unrecognized annotated " + annotated);
      }
docs: Returns the declaring {@link AnnotatedType} of a given annotated.
  
  For an {@link AnnotatedMember}, {@link AnnotatedMember#getDeclaringType()} is returned.
  For an {@link AnnotatedParameter}, the declaring annotated type of {@link AnnotatedParameter#getDeclaringCallable()} is returned.
  If the parameter is an {@link AnnotatedType}, it is returned.
  
  @throws IllegalArgumentException if the annotated parameter is an unknown non-standard {@link Annotated} subclass.