@Test public void shouldReturnCorrectGenericReturnType() { final TestJoinPoint testJoinPoint = new TestJoinPoint.Builder(MyDummyClass.class, "buildDummyObservable") .withReturnType(Observable.class) .build(); final FrodoJoinPoint frodoJoinPoint = new FrodoJoinPoint(testJoinPoint); assertThat(frodoJoinPoint.getGenericReturnTypes()).isEqualTo( Collections.singletonList(Observable.class)); }
public List<Class> getGenericReturnTypes() { final Type returnType = methodSignature.getMethod().getGenericReturnType(); if (returnType instanceof ParameterizedType) { final Type[] typeArguments = ((ParameterizedType) returnType).getActualTypeArguments(); final List<Class> genericReturnTypes = new ArrayList<>(typeArguments.length); for (Type typeArgument : typeArguments) { genericReturnTypes.add(typeArgument.getClass()); } return genericReturnTypes; } final Class clazz = (Class<?>) returnType; return Collections.singletonList(clazz); }
FrodoJoinPoint { public List<Class> getGenericReturnTypes() { final Type returnType = methodSignature.getMethod().getGenericReturnType(); if (returnType instanceof ParameterizedType) { final Type[] typeArguments = ((ParameterizedType) returnType).getActualTypeArguments(); final List<Class> genericReturnTypes = new ArrayList<>(typeArguments.length); for (Type typeArgument : typeArguments) { genericReturnTypes.add(typeArgument.getClass()); } return genericReturnTypes; } final Class clazz = (Class<?>) returnType; return Collections.singletonList(clazz); } }
FrodoJoinPoint { public List<Class> getGenericReturnTypes() { final Type returnType = methodSignature.getMethod().getGenericReturnType(); if (returnType instanceof ParameterizedType) { final Type[] typeArguments = ((ParameterizedType) returnType).getActualTypeArguments(); final List<Class> genericReturnTypes = new ArrayList<>(typeArguments.length); for (Type typeArgument : typeArguments) { genericReturnTypes.add(typeArgument.getClass()); } return genericReturnTypes; } final Class clazz = (Class<?>) returnType; return Collections.singletonList(clazz); } FrodoJoinPoint(JoinPoint joinPoint); }
FrodoJoinPoint { public List<Class> getGenericReturnTypes() { final Type returnType = methodSignature.getMethod().getGenericReturnType(); if (returnType instanceof ParameterizedType) { final Type[] typeArguments = ((ParameterizedType) returnType).getActualTypeArguments(); final List<Class> genericReturnTypes = new ArrayList<>(typeArguments.length); for (Type typeArgument : typeArguments) { genericReturnTypes.add(typeArgument.getClass()); } return genericReturnTypes; } final Class clazz = (Class<?>) returnType; return Collections.singletonList(clazz); } FrodoJoinPoint(JoinPoint joinPoint); String getClassSimpleName(); String getMethodName(); List<Class> getMethodParamTypesList(); List<String> getMethodParamNamesList(); List<Object> getMethodParamValuesList(); String getExecutionThreadName(); Annotation getAnnotation(Class<? extends Annotation> annotation); boolean hasReturnType(JoinPoint joinPoint); Class getReturnType(); List<Class> getGenericReturnTypes(); Object getTarget(); JoinPoint getJoinPoint(); @Override boolean equals(Object object); @Override int hashCode(); }
FrodoJoinPoint { public List<Class> getGenericReturnTypes() { final Type returnType = methodSignature.getMethod().getGenericReturnType(); if (returnType instanceof ParameterizedType) { final Type[] typeArguments = ((ParameterizedType) returnType).getActualTypeArguments(); final List<Class> genericReturnTypes = new ArrayList<>(typeArguments.length); for (Type typeArgument : typeArguments) { genericReturnTypes.add(typeArgument.getClass()); } return genericReturnTypes; } final Class clazz = (Class<?>) returnType; return Collections.singletonList(clazz); } FrodoJoinPoint(JoinPoint joinPoint); String getClassSimpleName(); String getMethodName(); List<Class> getMethodParamTypesList(); List<String> getMethodParamNamesList(); List<Object> getMethodParamValuesList(); String getExecutionThreadName(); Annotation getAnnotation(Class<? extends Annotation> annotation); boolean hasReturnType(JoinPoint joinPoint); Class getReturnType(); List<Class> getGenericReturnTypes(); Object getTarget(); JoinPoint getJoinPoint(); @Override boolean equals(Object object); @Override int hashCode();  }