This commit is contained in:
@@ -19,7 +19,7 @@ public final class WatchFactory {
|
||||
|
||||
private static final WatchFactory instance = new WatchFactory(null);
|
||||
|
||||
private final List<WeakReference<WatchBean>> beans = new CopyOnWriteArrayList<>();
|
||||
private final List<WeakReference<WatchNode>> beans = new CopyOnWriteArrayList<>();
|
||||
|
||||
private final WatchFactory parent;
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class WatchFactory {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void register(WatchBean bean) {
|
||||
public void register(WatchNode bean) {
|
||||
if (bean != null) beans.add(new WeakReference<>(bean));
|
||||
}
|
||||
|
||||
@@ -35,9 +35,10 @@ public final class WatchFactory {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// public WatchFactory createChild() {
|
||||
// return new WatchFactory(this);
|
||||
// }
|
||||
public WatchFactory createChild() {
|
||||
return new WatchFactory(this);
|
||||
}
|
||||
|
||||
public WatchNumber createWatchNumber(String name) {
|
||||
return createWatchNumber(name, "", false, 0);
|
||||
}
|
||||
@@ -86,7 +87,7 @@ public final class WatchFactory {
|
||||
if (Modifier.isFinal(field.getModifiers())) continue;
|
||||
field.setAccessible(true);
|
||||
final Class type = field.getType();
|
||||
WatchOn wo = field.getAnnotation(WatchOn.class);
|
||||
Watchable wo = field.getAnnotation(Watchable.class);
|
||||
|
||||
}
|
||||
} while ((clazz = clazz.getSuperclass()) != Object.class);
|
||||
|
||||
@@ -9,7 +9,7 @@ package com.wentch.redkale.watch;
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public interface WatchBean {
|
||||
public interface WatchNode {
|
||||
|
||||
public String getName();
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.concurrent.atomic.*;
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public final class WatchNumber extends AtomicLong implements WatchBean {
|
||||
public final class WatchNumber extends AtomicLong implements WatchNode {
|
||||
|
||||
private final boolean interval;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.function.LongSupplier;
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public final class WatchSupplier implements WatchBean {
|
||||
public final class WatchSupplier implements WatchNode {
|
||||
|
||||
private final String name;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@Documented
|
||||
@Target({FIELD})
|
||||
@Retention(RUNTIME)
|
||||
public @interface WatchOn {
|
||||
public @interface Watchable {
|
||||
|
||||
String name();
|
||||
|
||||
Reference in New Issue
Block a user