mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-28 16:47:25 -04:00
Introduce Activatable#NOOP_INSTANCE
... and use it instead of CachedViewCB#EMPTY_MODEL
This commit is contained in:
parent
eb310baae0
commit
892e3c33f9
2 changed files with 13 additions and 11 deletions
|
@ -21,4 +21,16 @@ public interface Activatable {
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
|
||||||
|
|
||||||
|
Activatable NOOP_INSTANCE = new Activatable() {;
|
||||||
|
@Override
|
||||||
|
public void activate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivate() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,22 +33,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
public class CachedViewCB<M extends Activatable> extends ViewCB<M> implements Activatable {
|
public class CachedViewCB<M extends Activatable> extends ViewCB<M> implements Activatable {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
private static final Logger log = LoggerFactory.getLogger(CachedViewCB.class);
|
||||||
|
|
||||||
protected static final Activatable EMPTY_MODEL = new Activatable() {
|
|
||||||
@Override
|
|
||||||
public void activate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deactivate() {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public CachedViewCB(M model) {
|
public CachedViewCB(M model) {
|
||||||
super(checkNotNull(model, "Model must not be null"));
|
super(checkNotNull(model, "Model must not be null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedViewCB() {
|
public CachedViewCB() {
|
||||||
this((M) EMPTY_MODEL);
|
this((M) Activatable.NOOP_INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue