Skip to content

Commit

Permalink
Merge pull request #59 from zalando/feature/api-guardian
Browse files Browse the repository at this point in the history
Annotated public API with @API
  • Loading branch information
whiskeysierra authored Apr 20, 2018
2 parents 692e65a + c60c93d commit b8e6b7a
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jackson-datatype-problem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import com.fasterxml.jackson.core.util.VersionUtil;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.apiguardian.api.API;

import java.util.HashMap;
import java.util.Map;

import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
public final class ProblemModule extends Module {

private final boolean stackTraces;
Expand Down
5 changes: 5 additions & 0 deletions problem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
</scm>

<dependencies>
<dependency>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gag.annotation.remark.Hack;
import com.google.gag.annotation.remark.OhNoYouDidnt;
import org.apiguardian.api.API;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
Expand All @@ -11,6 +12,10 @@
import java.util.Map;
import java.util.Optional;

import static org.apiguardian.api.API.Status.INTERNAL;
import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
@Immutable // TODO kind of a lie until we remove set(String, Object)
public abstract class AbstractThrowableProblem extends ThrowableProblem {

Expand Down Expand Up @@ -118,6 +123,7 @@ public Map<String, Object> getParameters() {
* @param value the custom value
* @see <a href="https://github.com/FasterXML/jackson-databind/issues/562">Jackson Issue 562</a>
*/
@API(status = INTERNAL)
@Hack
@OhNoYouDidnt
void set(final String key, final Object value) {
Expand Down
5 changes: 5 additions & 0 deletions problem/src/main/java/org/zalando/problem/DefaultProblem.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.zalando.problem;

import org.apiguardian.api.API;

import javax.annotation.Nullable;
import java.net.URI;
import java.util.Map;

import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
public final class DefaultProblem extends AbstractThrowableProblem {

// TODO needed for jackson
Expand Down
5 changes: 5 additions & 0 deletions problem/src/main/java/org/zalando/problem/Exceptional.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.zalando.problem;

import org.apiguardian.api.API;

import static org.apiguardian.api.API.Status.STABLE;

/**
* An extension of the {@link Problem} interface for problems that extend {@link Exception}. Since {@link Exception}
* is a concrete type any class can only extend one exception type. {@link ThrowableProblem} is one choice, but we
Expand All @@ -14,6 +18,7 @@
* @see Problem
* @see ThrowableProblem
*/
@API(status = STABLE)
public interface Exceptional extends Problem {

Exceptional getCause();
Expand Down
4 changes: 4 additions & 0 deletions problem/src/main/java/org/zalando/problem/Problem.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.zalando.problem;

import org.apiguardian.api.API;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import java.net.URI;
Expand All @@ -9,10 +11,12 @@
import java.util.stream.Stream;

import static java.util.stream.Collectors.joining;
import static org.apiguardian.api.API.Status.STABLE;

/**
* @see <a href="https://tools.ietf.org/html/rfc7807">RFC 7807: Problem Details for HTTP APIs</a>
*/
@API(status = STABLE)
@Immutable
public interface Problem {

Expand Down
5 changes: 5 additions & 0 deletions problem/src/main/java/org/zalando/problem/ProblemBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.zalando.problem;

import org.apiguardian.api.API;

import javax.annotation.Nullable;
import java.net.URI;
import java.util.Arrays;
Expand All @@ -8,6 +10,9 @@
import java.util.Map;
import java.util.Set;

import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
public final class ProblemBuilder {

private static final Set<String> RESERVED_PROPERTIES = new HashSet<>(Arrays.asList(
Expand Down
6 changes: 5 additions & 1 deletion problem/src/main/java/org/zalando/problem/Status.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package org.zalando.problem;

import javax.annotation.Nullable;
import org.apiguardian.api.API;

import static org.apiguardian.api.API.Status.MAINTAINED;
import static org.apiguardian.api.API.Status.STABLE;

/**
* Commonly used status codes defined by HTTP, see
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10">HTTP/1.1 documentation</a>
* for the complete list. Additional status codes can be added by applications
* by creating an implementation of StatusType.
*/
@API(status = MAINTAINED)
public enum Status implements StatusType {

/**
Expand Down
5 changes: 5 additions & 0 deletions problem/src/main/java/org/zalando/problem/StatusType.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.zalando.problem;


import org.apiguardian.api.API;

import static org.apiguardian.api.API.Status.STABLE;

/**
* Base interface for statuses.
*/
@API(status = STABLE)
public interface StatusType {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.zalando.problem;

import org.apiguardian.api.API;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import java.util.Collection;
Expand All @@ -8,8 +10,10 @@

import static java.util.Arrays.asList;
import static java.util.stream.Collectors.joining;
import static org.apiguardian.api.API.Status.STABLE;
import static org.zalando.problem.spi.StackTraceProcessor.COMPOUND;

@API(status = STABLE)
@Immutable
public abstract class ThrowableProblem extends RuntimeException implements Problem, Exceptional {

Expand Down

0 comments on commit b8e6b7a

Please sign in to comment.