Package com.sun.jersey.core.reflection

Examples of com.sun.jersey.core.reflection.MethodList


    }

    private static Method getPostConstructMethod(Class c) {
        Class postConstructClass = ReflectionHelper.classForName("javax.annotation.PostConstruct");
        if (postConstructClass != null) {
            MethodList methodList = new MethodList(c);
            for (AnnotatedMethod m : methodList.
                    hasAnnotation(postConstructClass).
                    hasNumParams(0).
                    hasReturnType(void.class)) {
                return m.getMethod();
            }
View Full Code Here


    }

    private static Method getPreDestroyMethod(Class c) {
        Class preDestroyClass = ReflectionHelper.classForName("javax.annotation.PreDestroy");
        if (preDestroyClass != null) {
            MethodList methodList = new MethodList(c);
            for (AnnotatedMethod m : methodList.
                    hasAnnotation(preDestroyClass).
                    hasNumParams(0).
                    hasReturnType(void.class)) {
                return m.getMethod();
            }
View Full Code Here

        workOutConstructorsList(resource, resourceClass.getConstructors(),
                isEncodedAnotOnClass);

        workOutFieldsList(resource, isEncodedAnotOnClass);
       
        final MethodList methodList = new MethodList(resourceClass);

        workOutSetterMethodsList(resource, methodList, isEncodedAnotOnClass);
       
        final Consumes classScopeConsumesAnnotation =
                annotatedResourceClass.getAnnotation(Consumes.class);
View Full Code Here

       
        if (!LOGGER.isLoggable(Level.WARNING)) {
            return; // does not make sense to check when logging is disabled anyway
        }
       
        final MethodList declaredMethods = new MethodList(
                getDeclaredMethods(resourceClass));

        // non-public resource methods
        for (AnnotatedMethod m : declaredMethods.hasMetaAnnotation(HttpMethod.class).
                hasNotAnnotation(Path.class).isNotPublic()) {
            LOGGER.warning(ImplMessages.NON_PUB_RES_METHOD(m.getMethod().toGenericString()));
        }
        // non-public subres methods
        for (AnnotatedMethod m : declaredMethods.hasMetaAnnotation(HttpMethod.class).
                hasAnnotation(Path.class).isNotPublic()) {
            LOGGER.warning(ImplMessages.NON_PUB_SUB_RES_METHOD(m.getMethod().toGenericString()));
        }
        // non-public subres locators
        for (AnnotatedMethod m : declaredMethods.hasNotMetaAnnotation(HttpMethod.class).
                hasAnnotation(Path.class).isNotPublic()) {
            LOGGER.warning(ImplMessages.NON_PUB_SUB_RES_LOC(m.getMethod().toGenericString()));
        }
    }
View Full Code Here

        workOutConstructorsList(resource, resourceClass.getConstructors(),
                isEncodedAnotOnClass);

        workOutFieldsList(resource, isEncodedAnotOnClass);
       
        final MethodList methodList = new MethodList(resourceClass);

        workOutSetterMethodsList(resource, methodList, isEncodedAnotOnClass);
       
        final Consumes classScopeConsumesAnnotation =
                annotatedResourceClass.getAnnotation(Consumes.class);
View Full Code Here

        if (postConstruct == null)
            return;

        Class preDestroy = ReflectionHelper.classForName("javax.annotation.PreDestroy");

        final MethodList methodList = new MethodList(resource.getResourceClass(), true);
        for (AnnotatedMethod m : methodList.
                hasAnnotation(postConstruct).
                hasNumParams(0).
                hasReturnType(void.class)) {
            ReflectionHelper.setAccessibleMethod(m.getMethod());
            resource.getPostConstructMethods().add(m.getMethod());
        }

        for (AnnotatedMethod m : methodList.
                hasAnnotation(preDestroy).
                hasNumParams(0).
                hasReturnType(void.class)) {
            ReflectionHelper.setAccessibleMethod(m.getMethod());
            resource.getPreDestroyMethods().add(m.getMethod());
View Full Code Here

            }
            oClass = oClass.getSuperclass();
        }

        MethodList ml = new MethodList(c.getMethods());
        int methodIndex = 0;
        for (AnnotatedMethod m : ml.
                hasNotMetaAnnotation(HttpMethod.class).
                hasNotAnnotation(Path.class).
                hasNumParams(1).
                hasReturnType(void.class).
                nameStartsWith("set")) {
View Full Code Here

    }

    private static Method getPostConstructMethod(Class c) {
        Class postConstructClass = ReflectionHelper.classForName("javax.annotation.PostConstruct");
        if (postConstructClass != null) {
            MethodList methodList = new MethodList(c, true);
            for (AnnotatedMethod m : methodList.
                    hasAnnotation(postConstructClass).
                    hasNumParams(0).
                    hasReturnType(void.class)) {
                ReflectionHelper.setAccessibleMethod(m.getMethod());
                return m.getMethod();
View Full Code Here

    }

    private static Method getPreDestroyMethod(Class c) {
        Class preDestroyClass = ReflectionHelper.classForName("javax.annotation.PreDestroy");
        if (preDestroyClass != null) {
            MethodList methodList = new MethodList(c, true);
            for (AnnotatedMethod m : methodList.
                    hasAnnotation(preDestroyClass).
                    hasNumParams(0).
                    hasReturnType(void.class)) {
                ReflectionHelper.setAccessibleMethod(m.getMethod());
                return m.getMethod();
View Full Code Here

        return ml;
    }

    private void checkNonPublicMethods(final AbstractResource ar) {

        final MethodList declaredMethods = new MethodList(
                getDeclaredMethods(ar.getResourceClass()));

        // non-public resource methods
        for (AnnotatedMethod m : declaredMethods.hasMetaAnnotation(HttpMethod.class).
                hasNotAnnotation(Path.class).isNotPublic()) {
            issueList.add(new ResourceModelIssue(ar, ImplMessages.NON_PUB_RES_METHOD(m.getMethod().toGenericString()), false));
        }
        // non-public subres methods
        for (AnnotatedMethod m : declaredMethods.hasMetaAnnotation(HttpMethod.class).
                hasAnnotation(Path.class).isNotPublic()) {
            issueList.add(new ResourceModelIssue(ar, ImplMessages.NON_PUB_SUB_RES_METHOD(m.getMethod().toGenericString()), false));
        }
        // non-public subres locators
        for (AnnotatedMethod m : declaredMethods.hasNotMetaAnnotation(HttpMethod.class).
                hasAnnotation(Path.class).isNotPublic()) {
            issueList.add(new ResourceModelIssue(ar, ImplMessages.NON_PUB_SUB_RES_LOC(m.getMethod().toGenericString()), false));
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.core.reflection.MethodList

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.