X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Freactor%2Fstates%2FAbstractState.java;h=6d7a6ea54e9518d3609aed9d27e930b0129376c1;hb=13a4fe6bece23b3dd561de657cf9bb7ea307e2b6;hp=f8d6f6923ceef3270f68e0f48a3a7b2f0db0810e;hpb=e5a3f0f0500c9ef27e5c7c8726b73aa04c358e9b;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/reactor/states/AbstractState.java b/src/main/java/net/pterodactylus/reactor/states/AbstractState.java index f8d6f69..6d7a6ea 100644 --- a/src/main/java/net/pterodactylus/reactor/states/AbstractState.java +++ b/src/main/java/net/pterodactylus/reactor/states/AbstractState.java @@ -19,15 +19,20 @@ package net.pterodactylus.reactor.states; import net.pterodactylus.reactor.State; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + /** * Abstract implementation of a {@link State} that knows about the basic * attributes of a {@link State}. * * @author David ‘Bombe’ Roden */ +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") public abstract class AbstractState implements State { /** The time of this state. */ + @JsonProperty private final long time; /** Whether the state was successfully retrieved. */ @@ -36,6 +41,10 @@ public abstract class AbstractState implements State { /** The optional exception that occured while retrieving the state. */ private final Throwable exception; + /** The number of consecutive failures. */ + @JsonProperty + private int failCount; + /** * Creates a new successful state. */ @@ -103,6 +112,22 @@ public abstract class AbstractState implements State { * {@inheritDoc} */ @Override + public int failCount() { + return failCount; + } + + /** + * {@inheritDoc} + */ + @Override + public void setFailCount(int failCount) { + this.failCount = failCount; + } + + /** + * {@inheritDoc} + */ + @Override public Throwable exception() { return exception; }