Keys { public static String getSetKey(Type type, Annotation[] annotations, Object subject) { Annotation qualifier = extractQualifier(annotations, subject); type = boxIfPrimitive(type); StringBuilder result = new StringBuilder(); if (qualifier != null) { result.append(qualifier).append("/"); } result.append(SET_PREFIX); typeToString(type, result, true); result.append(">"); return result.toString(); } Keys(); static String get(Type type); static String getMembersKey(Class<?> key); static String getSetKey(Type type, Annotation[] annotations, Object subject); static String get(Type type, Annotation[] annotations, Object subject); static boolean isAnnotated(String key); static String getClassName(String key); static boolean isPlatformType(String name);  }
@Test public void testGetElementKey_NoQualifier() throws NoSuchMethodException { Method method = KeysTest.class.getDeclaredMethod("elementProvides", new Class<?>[]{}); assertThat(Keys.getSetKey(method.getGenericReturnType(), method.getAnnotations(), method)) .isEqualTo("java.util.Set<java.lang.String>"); }
@Test public void testGetElementKey_WithQualifier() throws NoSuchMethodException { Method method = KeysTest.class.getDeclaredMethod("qualifiedElementProvides", new Class<?>[]{}); assertThat(Keys.getSetKey(method.getGenericReturnType(), method.getAnnotations(), method)) .isEqualTo("@javax.inject.Named(value=foo)/java.util.Set<java.lang.String>"); }