diff options
Diffstat (limited to 'vpp-integration/api-docs/api')
3 files changed, 29 insertions, 11 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() { |