code: public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedType, Class<T> annotationClass,
                                                           String error) {
          if (annotatedType == null) {
              throw new IllegalArgumentException(error);
          }
  
          if (annotatedType.isAnnotationPresent(annotationClass)) {
              return annotatedType.getAnnotation(annotationClass);
          } else {
              if (isNullOrEmpty(error)) {
                  throw new ODataSystemException("Could not load annotation: " + annotationClass
                          + " on source: " + annotatedType);
              } else {
                  throw new ODataSystemException(error);
              }
          }
      }
docs: Small utility to easily get an annotation and will throw an exception if not provided.
  
  @param annotatedType   The source type to tcheck the annotation on
  @param annotationClass The annotation to look for
  @param error           The error if the annotaton is not present, can be null a default error will be returned
  @param <T>             The annotation subtype
  @return The annotation that was requested
  @throws ODataSystemException If unable to find the annotation or nullpointer in case null source was specified