mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-18 14:55:53 -04:00
Introduce Activatable#NOOP_INSTANCE
... and use it instead of CachedViewCB#EMPTY_MODEL
This commit is contained in:
parent
eb310baae0
commit
892e3c33f9
@ -21,4 +21,16 @@ public interface Activatable {
|
||||
void activate();
|
||||
|
||||
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 {
|
||||
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) {
|
||||
super(checkNotNull(model, "Model must not be null"));
|
||||
}
|
||||
|
||||
public CachedViewCB() {
|
||||
this((M) EMPTY_MODEL);
|
||||
this((M) Activatable.NOOP_INSTANCE);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user