Package com.sun.jersey.api.model

Examples of com.sun.jersey.api.model.Parameter


        Map<Method, Injectable<?>> singletons = new HashMap<Method, Injectable<?>>();
        Map<Method, Injectable<?>> perRequest = new HashMap<Method, Injectable<?>>();
       
        AccessibleObjectContext aoc = new AccessibleObjectContext();
        for (AbstractSetterMethod sm : setterMethods) {
            Parameter p = sm.getParameters().get(0);
            aoc.setAccesibleObject(sm.getMethod(), p.getAnnotations());
           
            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
                        );           
                if (i != null) {
                    singletons.put(sm.getMethod(), i);                       
                }
View Full Code Here


            return;
       
        while (c != Object.class) {
             for (final Field f : c.getDeclaredFields()) {
                    final AbstractField af = new AbstractField(f);
                    Parameter p = createParameter(f.toString(), 1, isEncoded,
                            f.getType(),
                            f.getGenericType(),
                            f.getAnnotations());
                    if (null != p) {
                        af.getParameters().add(p);
View Full Code Here

                hasNumParams(1).
                hasReturnType(void.class).
                nameStartsWith("set")) {
           
            final AbstractSetterMethod asm = new AbstractSetterMethod(resource, m.getMethod(), m.getAnnotations());
            Parameter p = createParameter(m.toString(), 1, isEncoded,
                    m.getParameterTypes()[0],
                    m.getGenericParameterTypes()[0],
                    m.getAnnotations());
            if (null != p) {
                asm.getParameters().add(p);
View Full Code Here

            Class[] parameterTypes,
            Type[] genericParameterTypes,
            Annotation[][] parameterAnnotations) {

        for (int i = 0; i < parameterTypes.length; i++) {
            Parameter parameter = createParameter(
                    nameForLogging,
                    i + 1,
                    isEncoded, parameterTypes[i],
                    genericParameterTypes[i],
                    parameterAnnotations[i]);
View Full Code Here

        if (paramAnnotation == null) {
            paramSource = Parameter.Source.ENTITY;
        }

        return new Parameter(annotations, paramAnnotation, paramSource, paramName, paramType,
                paramClass, paramEncoded, paramDefault);
    }
View Full Code Here

            return null;
        }
       
        boolean hasFormParam = false;
        for (int i = 0; i < method.getParameters().size(); i++) {
            Parameter parameter = method.getParameters().get(i);
            if (parameter.getAnnotation() != null)
                hasFormParam |= parameter.getAnnotation().annotationType() == FormParam.class;           
        }
        if (!hasFormParam)
            return null;
       
        return getInjectables(method);
View Full Code Here

    }
   
    protected List<Injectable> getInjectables(AbstractResourceMethod method) {
        List<Injectable> is = new ArrayList<Injectable>(method.getParameters().size());
        for (int i = 0; i < method.getParameters().size(); i++) {
            Parameter p = method.getParameters().get(i);
           
            if (Parameter.Source.ENTITY == p.getSource()) {
                if (MultivaluedMap.class.isAssignableFrom(p.getParameterClass())) {
                    is.add(new FormEntityInjectable(p.getParameterClass(),
                            p.getParameterType(), p.getAnnotations()));
                } else
                    return null;
            } else if (p.getAnnotation().annotationType() == FormParam.class) {
                MultivaluedParameterExtractor e = MultivaluedParameterProcessor.
                        process(p.getDefaultValue(), p.getParameterClass(),
                        p.getParameterType(), p.getSourceName());   
                if (e == null)
                    return null;
                is.add(new FormParamInjectable(e, !p.isEncoded()));
               
            } else {
                Injectable injectable = sipc.getInjectable(p, ComponentScope.PerRequest);
                if (injectable == null)
                    return null;
View Full Code Here

        }

        boolean hasEntity = false;
        List<Injectable> is = new ArrayList<Injectable>(method.getParameters().size());
        for (int i = 0; i < method.getParameters().size(); i++) {
            Parameter parameter = method.getParameters().get(i);
           
            if (Parameter.Source.ENTITY == parameter.getSource()) {
                hasEntity = true;
                is.add(processEntityParameter(method,
                        parameter,
                        method.getMethod().getParameterAnnotations()[i],
                        requireNoEntityParameter));
View Full Code Here

   
    @Override
    protected List<Injectable> getInjectables(AbstractResourceMethod method) {
        List<Injectable> is = new ArrayList<Injectable>(method.getParameters().size());
        for (int i = 0; i < method.getParameters().size(); i++) {
            Parameter p = method.getParameters().get(i);
           
            if (Parameter.Source.ENTITY == p.getSource()) {
                if (MimeMultipart.class.isAssignableFrom(p.getParameterClass()) ||
                        MultivaluedMap.class.isAssignableFrom(p.getParameterClass())) {
                    is.add(new MultipartFormInjectable(p.getParameterClass(),
                            p.getParameterType(), p.getAnnotations()));
                } else {
                    is.add(null);                   
                }
            } else if (p.getAnnotation().annotationType() == FormParam.class) {
                if (FormDataContentDisposition.class == p.getParameterClass()) {
                    is.add(new DispositionParamInjectable(p));
                } else {
                    is.add(new MultipartFormParamInjectable(mbws, p));
                }
            } else {
View Full Code Here

       
        while (c != Object.class) {
             for (final Field f : c.getDeclaredFields()) {
                if (f.getDeclaredAnnotations().length > 0) {
                    final AbstractField af = new AbstractField(f);
                    Parameter p = createParameter(
                            resource.getResourceClass(),
                            f.getDeclaringClass(),
                            isEncoded,
                            f.getType(),
                            f.getGenericType(),
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.model.Parameter

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.