Package com.sun.jersey.spi.inject

Examples of com.sun.jersey.spi.inject.Injectable


        if (Collections.frequency(is, null) == 1) {
            final int i = is.lastIndexOf(null);
            final Parameter parameter = method.getParameters().get(i);
            if (Parameter.Source.UNKNOWN == parameter.getSource()) {
                if (!parameter.isQualified()) {
                    final Injectable ij = processEntityParameter(
                        parameter,
                        method.getMethod().getParameterAnnotations()[i]);
                    is.set(i, ij);
                }
            }
View Full Code Here


        ComponentContext ic = new AnnotatedContext(ao, p.getAnnotations());

        if (s == ComponentScope.PerRequest) {
            // Find a per request injectable with Parameter
            Injectable i = getInjectable(
                    p.getAnnotation().annotationType(),
                    ic,
                    p.getAnnotation(),
                    p,
                    ComponentScope.PerRequest);
View Full Code Here

      Object ha) {
    final Class type = null;
    if(containerNotReady()) {
      return null;
    }
    return new Injectable() {
      public Object getValue() {
        Container container = getContainer();
        return (IoCComponentProvider) (container.canProvide(type) ? container
          .instanceFor(type) : null);
      }
View Full Code Here

            @Override
            public Injectable getInjectable(ComponentContext ic, Context a, Type c) {
                final Object o = m.get(c);
                if (o != null) {
                    return new Injectable() {
                        @Override
                        public Object getValue() {
                            return o;
                        }
                    };
View Full Code Here

            @Override
            public Injectable getInjectable(ComponentContext ic, Context a, Type c) {
                final Object o = m.get(c);
                if (o != null) {
                    return new Injectable() {
                        @Override
                        public Object getValue() {
                            return o;
                        }
                    };
View Full Code Here

                // TODO check if concrete type
               
                final ContextResolver cr = getResolver(ic, type);
                if (cr == null) return null;
               
                return new Injectable() {
                    public Object getValue() {
                        return cr;
                    }
                };
            }
View Full Code Here

            ComponentContext ic,
            A a,
            C c,
            List<ComponentScope> ls) {
        for (ComponentScope s : ls) {
            Injectable i = _getInjectable(ac, ic, a, c, s);
            if (i != null)
                return i;
            else {
                // TODO log warnings if injection cannot be performed
                // This is a little tricky for injection of
View Full Code Here

            ComponentContext ic,
            A a,
            C c,
            ComponentScope s) {
        for (MetaInjectableProvider mip : findInjectableProviders(ac, c.getClass(), s)) {
            Injectable i = mip.ip.getInjectable(ic, a, c);
            if (i != null)
                return i;
        }
        return null;
    }
View Full Code Here

           
            if (p.getAnnotation() == null) continue;

            if (s == ComponentScope.PerRequest) {
                // Find a per request injectable with Parameter
                Injectable i = ipc.getInjectable(
                        p.getAnnotation().annotationType(),
                        aoc,
                        p.getAnnotation(),
                        p,
                        ComponentScope.PerRequest);
                if (i != null) {
                    configureField(af.getField());
                    perRequest.put(af.getField(), i);
                } else {
                    i = ipc.getInjectable(
                            p.getAnnotation().annotationType(),
                            aoc,
                            p.getAnnotation(),
                            p.getParameterType(),
                            ComponentScope.PERREQUEST_UNDEFINED
                            );
                    if (i != null) {
                        configureField(af.getField());
                        perRequest.put(af.getField(), i);                       
                    } else {
                        i = ipc.getInjectable(
                                p.getAnnotation().annotationType(),
                                aoc,
                                p.getAnnotation(),
                                p.getParameterType(),
                                ComponentScope.Singleton
                                );
                        if (i != null) {
                            configureField(af.getField());
                            singletons.put(af.getField(), i);                       
                        }
                    }
                }
            } else {
                Injectable i = ipc.getInjectable(
                        p.getAnnotation().annotationType(),
                        aoc,
                        p.getAnnotation(),
                        p.getParameterType(),
                        ComponentScope.UNDEFINED_SINGLETON
View Full Code Here

           
            if (p.getAnnotation() == null) continue;

            if (s == ComponentScope.PerRequest) {
                // Find a per request injectable with Parameter
                Injectable i = ipc.getInjectable(
                        p.getAnnotation().annotationType(),
                        aoc,
                        p.getAnnotation(),
                        p,
                        ComponentScope.PerRequest);
                if (i != null) {
                     perRequest.put(sm.getMethod(), i);
                } else {
                    i = ipc.getInjectable(
                            p.getAnnotation().annotationType(),
                            aoc,
                            p.getAnnotation(),
                            p.getParameterType(),
                            ComponentScope.PERREQUEST_UNDEFINED
                            );
                    if (i != null) {
                        perRequest.put(sm.getMethod(), i);                       
                    } else {
                        i = ipc.getInjectable(
                                p.getAnnotation().annotationType(),
                                aoc,
                                p.getAnnotation(),
                                p.getParameterType(),
                                ComponentScope.Singleton
                                );
                        if (i != null) {
                            singletons.put(sm.getMethod(), i);                       
                        }
                    }
                }
            } else {
                Injectable i = ipc.getInjectable(
                        p.getAnnotation().annotationType(),
                        aoc,
                        p.getAnnotation(),
                        p.getParameterType(),
                        ComponentScope.UNDEFINED_SINGLETON
View Full Code Here

TOP

Related Classes of com.sun.jersey.spi.inject.Injectable

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.