Package java.lang.annotation

Examples of java.lang.annotation.Annotation


    public <A extends Annotation> boolean isAnnotationPresent(Class<A> annotationClass) {
        return getAnnotation(annotationClass) != null;
    }

    public <A extends Annotation> boolean isAnnotationValuePresent(Class<A> annotationClass, String memberName) {
        Annotation annotation = getAnnotation(annotationClass);
        return annotation != null && getAnnotationValue(annotation, memberName) != null;
    }
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public <T, A extends Annotation> T getAnnotatedValue(Class<A> annotationClass, Class<T> memberType,
            String memberName) {
        Annotation annotation = getAnnotation(annotationClass);
        if (annotation != null) {
            return (T) getAnnotationValue(annotation, memberName);
        }
        throw new AnnotationRequired(annotatedClass, annotationClass);
    }
View Full Code Here

  /**
   * Returns true if the binding annotation is in the wrong place.
   */
  private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) {
    Annotation misplacedBindingAnnotation = Annotations.findBindingAnnotation(
        errors, member, ((AnnotatedElement) member).getAnnotations());
    if (misplacedBindingAnnotation == null) {
      return false;
    }

View Full Code Here

      return Modifier.isFinal(method.getModifiers());
    }
  }

  static Annotation getAtInject(AnnotatedElement member) {
    Annotation a = member.getAnnotation(javax.inject.Inject.class);
    return a == null ? member.getAnnotation(Inject.class) : a;
  }
View Full Code Here

      TypeLiteral<?> current = hierarchy.get(i);

      for (Field field : current.getRawType().getDeclaredFields()) {
        if (Modifier.isStatic(field.getModifiers()) == statics) {
          Annotation atInject = getAtInject(field);
          if (atInject != null) {
            InjectableField injectableField = new InjectableField(current, field, atInject);
            if (injectableField.jsr330 && Modifier.isFinal(field.getModifiers())) {
              errors.cannotInjectFinalField(field);
            }
            injectableMembers.add(injectableField);
          }
        }
      }

      for (Method method : current.getRawType().getDeclaredMethods()) {
        if (isEligibleForInjection(method, statics)) {
          Annotation atInject = getAtInject(method);
          if (atInject != null) {
            InjectableMethod injectableMethod = new InjectableMethod(
                current, method, atInject);
            if (checkForMisplacedBindingAnnotations(method, errors)
                || !isValidMethod(injectableMethod, errors)) {
View Full Code Here

    private OAuthService getUnambiguousService() {
        // Attempts to get the only configured service
        if (extension.getSocialRelated().size() == 1) {
            String name = getOnlyElement(extension.getSocialRelated());
            Annotation qualifier = SeamSocialExtension.getServicesToQualifier().inverse().get(name);
            return serviceInstances.select(qualifier).get();
        } else {
            throw new IllegalStateException("Service name not set and there is no unambiguous OAuthService available");
        }
    }
View Full Code Here

                    + m.getJavaMember().getDeclaringClass().getName() + "." + m.getJavaMember().getName()
                    + "] - does not return a boolean.");
        }

        // Locate the binding type
        Annotation binding = null;

        for (Annotation a : m.getAnnotations()) {
            if (a.annotationType().isAnnotationPresent(SecurityBindingType.class)) {
                if (binding != null) {
                    throw new SecurityDefinitionException("Invalid authorizer method ["
View Full Code Here

        for (Class<?> controllerClass : controllerClasses) {

            logger.debug("found controller class: " + controllerClass.getName());

            Annotation controllerAnnotation = getControllerAnnotation(controllerClass);

            String controllerVariable = getControllerVariable(controllerClass, controllerAnnotation);

            addControllerClass(controllerVariable, controllerClass);
        }
View Full Code Here

    }

    private Annotation getControllerAnnotation(Class<?> controllerClass) {

        Annotation[] controllerAnnotations = controllerClass.getAnnotations();
        Annotation controllerAnnotation = null;
        for (Annotation annot : controllerAnnotations) {

            if (annot instanceof StatelessController || annot instanceof StatefulController
                    || annot instanceof SingletonController) {
View Full Code Here

        setInterceptorsFor(controllerClass);
    }

    private void checkForInitController(Class<?> controllerClass) {

        Annotation annot = controllerClass.getAnnotation(Init.class);
        if (annot != null) {
            /* do some validation */
            annot = controllerClass.getAnnotation(SingletonController.class);
            if (annot == null) {
                throw new ConfigurationException("only a @" + SingletonController.class.getSimpleName()
View Full Code Here

TOP

Related Classes of java.lang.annotation.Annotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.