Package java.lang.reflect

Examples of java.lang.reflect.Method.toGenericString()


        Assert.assertTrue(Modifier.isStatic(field.getModifiers()));

        Assert.assertTrue(Resource.class.isAssignableFrom(cls));

        Method m = cls.getMethod("getList", List.class);
        System.out.println(m.toGenericString());
        Type type = m.getGenericParameterTypes()[0];
        Assert.assertTrue(type instanceof ParameterizedType);
        ParameterizedType pType = (ParameterizedType)type;
        Assert.assertEquals(String.class, pType.getActualTypeArguments()[0]);
View Full Code Here


        if (method != null)
            try {
                method.invoke(source, evt);
            } catch (Exception e) {
                throw new RuntimeException("Invocation Failed. " + evt.getPropertyName() + " - " + method.toGenericString(), e);
            }
    }
}
View Full Code Here

        Assert.assertTrue(Modifier.isStatic(field.getModifiers()));

        Assert.assertTrue(Resource.class.isAssignableFrom(cls));

        Method m = cls.getMethod("getList", List.class);
        System.out.println(m.toGenericString());
        Type type = m.getGenericParameterTypes()[0];
        Assert.assertTrue(type instanceof ParameterizedType);
        ParameterizedType pType = (ParameterizedType)type;
        Assert.assertEquals(String.class, pType.getActualTypeArguments()[0]);
View Full Code Here

    public String toString()
    {
        if (object instanceof Method)
        {
            Method method = (Method) object;
            return "(method=" + method.toGenericString() + ", parameter: " + parameterNumber + ")";
        }
        else if (object instanceof Constructor<?>)
        {
            Constructor<?> ctor = (Constructor<?>) object;
            return "(method=" + ctor.toGenericString() + ", parameter: " + parameterNumber + ")";
View Full Code Here

                    // Ensure the method has only the one parameter
                    if (method.getParameterTypes().length != 1) {
                        throw new StripesRuntimeException(
                            "A method marked with @Reference must have exactly one parameter: " +
                            "the bean to be injected. Method [" + method.toGenericString() + "] has " +
                            method.getParameterTypes().length + " parameters."
                        );
                    }
                }
            }
View Full Code Here

                    // Ensure the method has only the one parameter
                    if (method.getParameterTypes().length != 1) {
                        throw new StripesRuntimeException(
                            "A method marked with @SpringBean must have exactly one parameter: " +
                            "the bean to be injected. Method [" + method.toGenericString() + "] has " +
                            method.getParameterTypes().length + " parameters."
                        );
                    }
                }
            }
View Full Code Here

    }

    @Override
    public void visitAbstractSetterMethod(AbstractSetterMethod setterMethod) {
        final Method m = setterMethod.getMethod();
        checkParameter(setterMethod.getParameters().get(0), m, m.toGenericString(), "1");
    }

    @Override
    public void visitAbstractResourceMethod(AbstractResourceMethod method) {
        checkParameters(method, method.getMethod());
View Full Code Here

        final Method handlingMethod = invocable.getHandlingMethod();
        int paramCount = 0;
        int nonAnnotetedParameters = 0;

        for (Parameter p : invocable.getParameters()) {
            validateParameter(p, handlingMethod, handlingMethod.toGenericString(), Integer.toString(++paramCount), false);
            if (method.getType() == ResourceMethod.JaxrsType.SUB_RESOURCE_LOCATOR
                    && Parameter.Source.ENTITY == p.getSource()) {
                Errors.fatal(method, LocalizationMessages.SUBRES_LOC_HAS_ENTITY_PARAM(invocable.getHandlingMethod()));
            } else if (p.getAnnotations().length == 0) {
                nonAnnotetedParameters++;
View Full Code Here

            if (log.isDebugEnabled()) {
                log.debug("Exception invoking a method of " +
                        serviceImplClass.toString() + " of instance " +
                        serviceInstance.toString());
                log.debug("Exception type thrown: " + e.getClass().getName());
                log.debug("Method = " + target.toGenericString());
                for (int i = 0; i < methodInputParams.length; i++) {
                    String value = (methodInputParams[i] == null) ? "null" :
                            methodInputParams[i].getClass().toString();
                    log.debug(" Argument[" + i + "] is " + value);
                }
View Full Code Here

    public static void main(String[] args) throws Exception
    {
        Method m = FindTheParameterizedType.class.getMethod("method", Map.class, List.class);

        out.println(m.toString());
        out.println(m.toGenericString());

        Type[] types = m.getGenericParameterTypes();
        ParameterizedType pt = (ParameterizedType) types[0];

        Type keyType = pt.getActualTypeArguments()[0];
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.