diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-07-27 09:04:16 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-07-27 23:43:38 +0200 |
commit | 3f84e52dd2e8ef2ed7b2a063519e9f9740258170 (patch) | |
tree | ce9a6149457c1d8b41413c3ba74a185722e301e5 /vpp-integration/api-docs | |
parent | f53271c5d9575e068262b8c5214f7afb35fc99ec (diff) |
Api docs: api list sorted in natural order
Change-Id: Ide2316c50ee144055eab2499fd241ca1ea354066
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-integration/api-docs')
4 files changed, 30 insertions, 12 deletions
diff --git a/vpp-integration/api-docs/api/pom.xml b/vpp-integration/api-docs/api/pom.xml index 78361fdd2..52c24ea80 100644 --- a/vpp-integration/api-docs/api/pom.xml +++ b/vpp-integration/api-docs/api/pom.xml @@ -25,6 +25,13 @@ <relativePath>../../../common/hc2vpp-parent</relativePath> </parent> <modelVersion>4.0.0</modelVersion> + <dependencies> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.0</version> + </dependency> + </dependencies> <properties> <sonar.skip>true</sonar.skip> diff --git a/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/CoverageUnit.java b/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/CoverageUnit.java index e04d28304..5c8247177 100644 --- a/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/CoverageUnit.java +++ b/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/CoverageUnit.java @@ -16,15 +16,18 @@ package io.fd.hc2vpp.docs.api; +import static java.util.Objects.requireNonNull; + import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Set; +import javax.annotation.Nonnull; /** * Represents mapping between single supported VPP binary api and its binding */ -public class CoverageUnit { +public class CoverageUnit implements Comparable<CoverageUnit> { /** * VPP binary api reference @@ -46,13 +49,13 @@ public class CoverageUnit { */ private final Collection<Operation> supportedOperations; - private CoverageUnit(final VppApiMessage vppApi, final JavaApiMessage javaApi, - final List<YangType> yangTypes, - final Collection<Operation> supportedOperations) { - this.vppApi = vppApi; - this.javaApi = javaApi; - this.yangTypes = yangTypes; - this.supportedOperations = supportedOperations; + private CoverageUnit(@Nonnull final VppApiMessage vppApi, @Nonnull final JavaApiMessage javaApi, + @Nonnull final List<YangType> yangTypes, + @Nonnull final Collection<Operation> supportedOperations) { + this.vppApi = requireNonNull(vppApi, "vppApi should not be null"); + this.javaApi = requireNonNull(javaApi, "javaApi should not be null"); + this.yangTypes = requireNonNull(yangTypes, "yangTypes should not be null"); + this.supportedOperations = requireNonNull(supportedOperations, "supportedOperations should not be null"); } public VppApiMessage getVppApi() { @@ -93,6 +96,11 @@ public class CoverageUnit { return Objects.hash(vppApi, javaApi, yangTypes, supportedOperations); } + @Override + public int compareTo(final CoverageUnit o) { + return vppApi.getName().compareTo(o.getVppApi().getName()); + } + public static class CoverageUnitBuilder { private VppApiMessage vppApi; private JavaApiMessage javaApi; diff --git a/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/VppApiMessage.java b/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/VppApiMessage.java index 78010471a..5be743241 100644 --- a/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/VppApiMessage.java +++ b/vpp-integration/api-docs/api/src/main/java/io/fd/hc2vpp/docs/api/VppApiMessage.java @@ -16,7 +16,10 @@ package io.fd.hc2vpp.docs.api; +import static java.util.Objects.requireNonNull; + import java.util.Objects; +import javax.annotation.Nonnull; /** * Represents reference to VPP binary api @@ -34,9 +37,9 @@ public class VppApiMessage { // TODO - check if possible to add direct link for specific api private final String link; - public VppApiMessage(final String name, final String link) { - this.name = name; - this.link = link; + public VppApiMessage(@Nonnull final String name, @Nonnull final String link) { + this.name = requireNonNull(name, "name should not be null"); + this.link = requireNonNull(link, "link should not be null"); } public String getName() { diff --git a/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy b/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy index ae6ebc606..de15d7b9b 100644 --- a/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy +++ b/vpp-integration/api-docs/scripts/src/main/groovy/io/fd/hc2vpp/docs/scripts/ApiDocsIndexGenerator.groovy @@ -123,7 +123,7 @@ class ApiDocsIndexGenerator { } private static String generateConfigTableContent(final Set<CoverageUnit> coverage) { - coverage.stream() + coverage.stream().sorted() .map { unit -> "$NL" + "${vppApiWithLink(unit.vppApi)}" + |