Commit f09f1d0f authored by 薛涛 Toby Xue's avatar 薛涛 Toby Xue 🆒

load handler

parent b6697b5f
Pipeline #4023 canceled with stages
...@@ -4,23 +4,12 @@ import logwire.core.bo.object.BizObject; ...@@ -4,23 +4,12 @@ import logwire.core.bo.object.BizObject;
import java.util.List; import java.util.List;
public interface ListOperationEventEventHandler<X extends BizObject> extends OperationEventHandler { public interface ListOperationEventHandler<X extends BizObject> extends OperationEventHandler {
String getOperation();
boolean isEnabled();
default String getQuery() { default String getQuery() {
return ""; return "";
} }
default boolean isAfter() {
return true;
}
default int getOrder() {
return 1000;
}
default void doBefore(List<X> xList, Object... args) { default void doBefore(List<X> xList, Object... args) {
//调用行为同名方法 //调用行为同名方法
} }
......
...@@ -2,23 +2,12 @@ package logwire.core.bo.eventhandler; ...@@ -2,23 +2,12 @@ package logwire.core.bo.eventhandler;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
public interface ObjectOperationEventEventHandler<X extends BizObject> extends OperationEventHandler { public interface ObjectOperationEventHandler<X extends BizObject> extends OperationEventHandler {
String getOperation();
boolean isEnabled();
default String getQuery() { default String getQuery() {
return ""; return "";
} }
default boolean isAfter() {
return true;
}
default int getOrder() {
return 1000;
}
default void doBefore(X x, Object... args) { default void doBefore(X x, Object... args) {
//调用行为同名方法 //调用行为同名方法
} }
......
package logwire.core.bo.eventhandler; package logwire.core.bo.eventhandler;
public interface OperationEventHandler { import logwire.core.bo.handler.Handler;
public interface OperationEventHandler extends Handler {
default boolean isAfter() {
return true;
}
} }
...@@ -2,22 +2,7 @@ package logwire.core.bo.eventhandler; ...@@ -2,22 +2,7 @@ package logwire.core.bo.eventhandler;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
public interface TypeOperationEventEventHandler<X extends BizObject> extends OperationEventHandler { public interface TypeOperationEventHandler<X extends BizObject> extends OperationEventHandler {
String getOperation();
boolean isEnabled();
default String getQuery() {
return "";
}
default boolean isAfter() {
return true;
}
default int getOrder() {
return 1000;
}
default void doBefore(Class<X> xClass, Object... args) { default void doBefore(Class<X> xClass, Object... args) {
//调用行为同名方法 //调用行为同名方法
......
package logwire.core.bo.handler;
public interface Handler {
/**
* 操作名称
*
* @return
*/
String getOperation();
/**
* 是否启用
*
* @return
*/
boolean isEnabled();
/**
*
* //TODO getQuery???
* @return
*/
default String getQuery() {
return "";
}
/**
* 优先级, 值越小优先级越高
*
* @return
*/
default Integer getOrder() {
return 1000;
}
}
...@@ -6,6 +6,10 @@ import java.util.List; ...@@ -6,6 +6,10 @@ import java.util.List;
public interface ListOperationHandler<X extends BizObject> extends OperationHandler { public interface ListOperationHandler<X extends BizObject> extends OperationHandler {
default String getQuery() {
return "";
}
default boolean accept(List<X> xList, Object... args) { default boolean accept(List<X> xList, Object... args) {
return true; return true;
} }
......
...@@ -4,6 +4,10 @@ import logwire.core.bo.object.BizObject; ...@@ -4,6 +4,10 @@ import logwire.core.bo.object.BizObject;
public interface ObjectOperationHandler<X extends BizObject> extends OperationHandler { public interface ObjectOperationHandler<X extends BizObject> extends OperationHandler {
default String getQuery() {
return "";
}
default boolean accept(X x, Object... args) { default boolean accept(X x, Object... args) {
return true; return true;
} }
......
package logwire.core.bo.handler; package logwire.core.bo.handler;
public interface OperationHandler { public interface OperationHandler extends Handler {
String getOperation();
boolean isEnabled();
default String getQuery() {
return "";
}
default Integer getOrder() {
return 1000;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment