Package javax.inject

Examples of javax.inject.Named


    }

    public static void checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
    {
        Set<Annotation> qualifierset = injectionPoint.getQualifiers();
        Named namedQualifier = null;
        for(Annotation qualifier : qualifierset)
        {
            if(qualifier.annotationType().equals(Named.class))
            {
                namedQualifier = (Named)qualifier;
                break;
            }
        }

        if(namedQualifier != null)
        {
            String value = namedQualifier.value();

            if(value == null || value.equals(""))
            {
                Member member = injectionPoint.getMember();
                if(!(member instanceof Field))
View Full Code Here


       
        for (Annotation anno : setQualifiers) {
            if (anno.annotationType().equals(Default.class)) continue;
           
            if (anno.annotationType().equals(Named.class)) {
                Named named = (Named) anno;
                if ("".equals(named.value())) {
                    Annotated annotated = injectionPoint.getAnnotated();
                    if (annotated instanceof AnnotatedField) {
                        AnnotatedField<?> annotatedField = (AnnotatedField<?>) annotated;
                       
                        Field field = annotatedField.getJavaMember();
View Full Code Here

                    scopeTypeFound = true;
                }
            }
            else if (annotType.equals(Named.class))
            {
                Named name = (Named) annotation;
                if (!name.value().equals(""))
                {
                    throw new WebBeansConfigurationException("@StereoType annotation can not define @Named " +
                            "annotation with value");
                }
            }
View Full Code Here

        String name = null;
        boolean hasName = false;
        if(AnnotationUtil.hasMethodAnnotation(superMethod, Named.class))
        {
            Named named =  superMethod.getAnnotation(Named.class);
            hasName = true;
            if(!named.value().equals(""))
            {
                name = named.value();
            }
            else
            {
                name = WebBeansUtil.getProducerDefaultName(superMethod.getName());
            }
View Full Code Here

     *
     * @param implClass The class to evaluate
     * @return The name this class should have
     */
    public static String getName(Class<?> implClass) {
        Named named = implClass.getAnnotation(Named.class);
       
        String namedName = (named != null) ? getNamedName(named, implClass) : null ;
       
        if (namedName != null) return namedName;
       
View Full Code Here

       
        for (Annotation annotation : annotatedGuy.getAnnotations()) {
            if (isAnnotationAQualifier(annotation)) {
                if ((annotatedGuy instanceof Field) &&
                        Named.class.equals(annotation.annotationType())) {
                    Named n = (Named) annotation;
                    if (n.value() == null || "".equals(n.value())) {
                        // Because we do not have access to AnnotationLiteral
                        // we cannot "fix" a Named annotation that has no explicit
                        // value here, and we must rely on the caller of this
                        // method to "fix" that case for us
                        continue;
View Full Code Here

      return;
    }
     
        // try register named component
        if (component.isAnnotationPresent(Named.class)) {
            Named named = ((Class<?>) component).getAnnotation(Named.class);
            logger.debug("Binding {} to {} with @Named({})", new Object[] { required, component, named.value() });
            binder.bind(required).annotatedWith(named).to(component);
        } else if (!boundClasses.contains(required)) {
            logger.debug("Binding {} to {}", required, component);
            binder.bind(required).to(component);
            boundClasses.add(required);
View Full Code Here

    }

    public static void checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
    {
        Set<Annotation> qualifierset = injectionPoint.getQualifiers();
        Named namedQualifier = null;
        for(Annotation qualifier : qualifierset)
        {
            if(qualifier.annotationType().equals(Named.class))
            {
                namedQualifier = (Named)qualifier;
                break;
            }
        }

        if(namedQualifier != null)
        {
            String value = namedQualifier.value();

            if(value == null || value.equals(""))
            {
                Member member = injectionPoint.getMember();
                if(!(member instanceof Field))
View Full Code Here

    boolean required;
    if (annot != null) {
      name = annot.name();
      required = annot.required();
    } else {
      Named named = field.getAnnotation(Named.class);
      name = named != null ? named.value() : "";
      required = false;
    }

    if (Strings.isEmpty(name))
    {
View Full Code Here

        }, classLoader));
    }
   
    @Test
    public void isNamed() {
        assertTrue(BindingConditions.isNamed(Tire.class, "spare").fulfilled(null, Tire.class, null, new Named() {
           
            @Override
            public Class<? extends Annotation> annotationType() {
                return Named.class;
            }
View Full Code Here

TOP

Related Classes of javax.inject.Named

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.