コード例 #1
0
  List<ApiExampleDocument> getExampleDocuments(ResourceMethod method) {
    if (null == method) return Collections.emptyList();

    final Collection<ApiExampleDocument> documents =
        Collections2.transform(
            Arrays.asList(method.examples()),
            new Function<ApiCallExample, ApiExampleDocument>() {
              @Override
              public ApiExampleDocument apply(ApiCallExample apiCallExample) {
                return new ApiExampleDocument(
                    apiCallExample.title(),
                    apiCallExample.description(),
                    apiCallExample.input(),
                    apiCallExample.contentType(),
                    apiCallExample.output(),
                    apiCallExample.accepts());
              }
            });

    return ImmutableList.copyOf(documents);
  }