@Test public void testAnnotatedMethodToString() { assertEquals("void doSomething(@Observes String)", JsonObjects.annotatedMethodToString(getFooAnnotatedMethod("doSomething"), Foo.class).trim()); assertEquals("public <T> T hello(T, Integer)", JsonObjects.annotatedMethodToString(getFooAnnotatedMethod("hello"), Foo.class).trim()); assertEquals("int getAge(String)", JsonObjects.annotatedMethodToString(getFooAnnotatedMethod("getAge"), Foo.class).trim()); assertEquals("static String[] getArray()", JsonObjects.annotatedMethodToString(getFooAnnotatedMethod("getArray"), Foo.class).trim()); }
static String annotatedMethodToString(AnnotatedMethod<?> method, Class<?> beanClass) { StringBuilder builder = new StringBuilder(); builder.append(Formats.addSpaceIfNeeded(Formats.formatAnnotations(method.getAnnotations()))); builder.append(Formats.formatModifiers(method.getJavaMember().getModifiers())); TypeVariable<Method>[] typeParams = method.getJavaMember().getTypeParameters(); builder.append(' '); if (typeParams.length > 0) { builder.append(Formats.formatTypeParameters(typeParams)); builder.append(' '); } builder.append(Formats.formatType(method.getJavaMember().getGenericReturnType())); builder.append(' '); if (!beanClass.getName().equals(method.getDeclaringType().getJavaClass().getName())) { builder.append(Formats.formatType(method.getDeclaringType().getJavaClass())); builder.append('.'); } builder.append(method.getJavaMember().getName()); builder.append(Formats.formatAsFormalParameterList(method.getParameters())); return builder.toString(); }
JsonObjects { static String annotatedMethodToString(AnnotatedMethod<?> method, Class<?> beanClass) { StringBuilder builder = new StringBuilder(); builder.append(Formats.addSpaceIfNeeded(Formats.formatAnnotations(method.getAnnotations()))); builder.append(Formats.formatModifiers(method.getJavaMember().getModifiers())); TypeVariable<Method>[] typeParams = method.getJavaMember().getTypeParameters(); builder.append(' '); if (typeParams.length > 0) { builder.append(Formats.formatTypeParameters(typeParams)); builder.append(' '); } builder.append(Formats.formatType(method.getJavaMember().getGenericReturnType())); builder.append(' '); if (!beanClass.getName().equals(method.getDeclaringType().getJavaClass().getName())) { builder.append(Formats.formatType(method.getDeclaringType().getJavaClass())); builder.append('.'); } builder.append(method.getJavaMember().getName()); builder.append(Formats.formatAsFormalParameterList(method.getParameters())); return builder.toString(); } }
JsonObjects { static String annotatedMethodToString(AnnotatedMethod<?> method, Class<?> beanClass) { StringBuilder builder = new StringBuilder(); builder.append(Formats.addSpaceIfNeeded(Formats.formatAnnotations(method.getAnnotations()))); builder.append(Formats.formatModifiers(method.getJavaMember().getModifiers())); TypeVariable<Method>[] typeParams = method.getJavaMember().getTypeParameters(); builder.append(' '); if (typeParams.length > 0) { builder.append(Formats.formatTypeParameters(typeParams)); builder.append(' '); } builder.append(Formats.formatType(method.getJavaMember().getGenericReturnType())); builder.append(' '); if (!beanClass.getName().equals(method.getDeclaringType().getJavaClass().getName())) { builder.append(Formats.formatType(method.getDeclaringType().getJavaClass())); builder.append('.'); } builder.append(method.getJavaMember().getName()); builder.append(Formats.formatAsFormalParameterList(method.getParameters())); return builder.toString(); } private  JsonObjects(); }
JsonObjects { static String annotatedMethodToString(AnnotatedMethod<?> method, Class<?> beanClass) { StringBuilder builder = new StringBuilder(); builder.append(Formats.addSpaceIfNeeded(Formats.formatAnnotations(method.getAnnotations()))); builder.append(Formats.formatModifiers(method.getJavaMember().getModifiers())); TypeVariable<Method>[] typeParams = method.getJavaMember().getTypeParameters(); builder.append(' '); if (typeParams.length > 0) { builder.append(Formats.formatTypeParameters(typeParams)); builder.append(' '); } builder.append(Formats.formatType(method.getJavaMember().getGenericReturnType())); builder.append(' '); if (!beanClass.getName().equals(method.getDeclaringType().getJavaClass().getName())) { builder.append(Formats.formatType(method.getDeclaringType().getJavaClass())); builder.append('.'); } builder.append(method.getJavaMember().getName()); builder.append(Formats.formatAsFormalParameterList(method.getParameters())); return builder.toString(); } private  JsonObjects();  }
JsonObjects { static String annotatedMethodToString(AnnotatedMethod<?> method, Class<?> beanClass) { StringBuilder builder = new StringBuilder(); builder.append(Formats.addSpaceIfNeeded(Formats.formatAnnotations(method.getAnnotations()))); builder.append(Formats.formatModifiers(method.getJavaMember().getModifiers())); TypeVariable<Method>[] typeParams = method.getJavaMember().getTypeParameters(); builder.append(' '); if (typeParams.length > 0) { builder.append(Formats.formatTypeParameters(typeParams)); builder.append(' '); } builder.append(Formats.formatType(method.getJavaMember().getGenericReturnType())); builder.append(' '); if (!beanClass.getName().equals(method.getDeclaringType().getJavaClass().getName())) { builder.append(Formats.formatType(method.getDeclaringType().getJavaClass())); builder.append('.'); } builder.append(method.getJavaMember().getName()); builder.append(Formats.formatAsFormalParameterList(method.getParameters())); return builder.toString(); } private  JsonObjects();   }