@Override public Iterable<ApiMetadata> getApis() { return ImmutableSet.<ApiMetadata>builder() .addAll(transform(Apis.all(), ToApiMetadata.INSTANCE)) .build(); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
private static Map<String,ApiMetadata> getApisMap() { Map<String,ApiMetadata> result = Maps.newLinkedHashMap(); for (ApiMetadata api: Apis.all()) { result.put(api.getId(), api); } return ImmutableMap.copyOf(result); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
/** * Returns the first api with the provided id * * @param id * the id of the api to return * * @return the api with the given id * * @throws NoSuchElementException * whenever there are no apis with the provided id */ public static ApiMetadata withId(String id) throws NoSuchElementException { return find(all(), ApiPredicates.id(id)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> contextAssignableFrom(TypeToken<?> type) { return filter(all(), ApiPredicates.contextAssignableFrom(type)); }
/** * Returns all apis who's contexts are assignable from the parameter * * @param type * the type of the context to search for * * @return the apis with contexts assignable from given type */ public static Iterable<ApiMetadata> viewableAs(TypeToken<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(type)); }
public static Iterable<ApiMetadata> viewableAs(Class<? extends View> type) { return filter(all(), ApiPredicates.viewableAs(typeToken(type))); }
@Test public void testAllContains() { ImmutableSet<ApiMetadata> all = ImmutableSet.copyOf(Apis.all()); assert all.contains(toTest) : String.format("%s not found in %s", toTest, all); }
@Test public void testAllContains() { ImmutableSet<ApiMetadata> all = ImmutableSet.copyOf(Apis.all()); assert all.contains(toTest) : String.format("%s not found in %s", toTest, all); }
@Test public void testAll() { Iterable<ApiMetadata> apisMetadata = Apis.all(); for (ApiMetadata apiMetadata : apisMetadata) { if (apiMetadata.getName().equals(testBlobstoreApi.getName())) { assertEquals(testBlobstoreApi, apiMetadata); } else if (apiMetadata.getName().equals(testComputeApi.getName())) { assertEquals(testComputeApi, apiMetadata); } else { assertEquals(testYetAnotherComputeApi, apiMetadata); } } }
@Test public void testAll() { Iterable<ApiMetadata> apisMetadata = Apis.all(); for (ApiMetadata apiMetadata : apisMetadata) { if (apiMetadata.getName().equals(testBlobstoreApi.getName())) { assertEquals(testBlobstoreApi, apiMetadata); } else if (apiMetadata.getName().equals(testComputeApi.getName())) { assertEquals(testComputeApi, apiMetadata); } else { assertEquals(testYetAnotherComputeApi, apiMetadata); } } }