FilterNode、FilterJoinNode增加copy方法

This commit is contained in:
Redkale
2018-10-18 14:47:07 +08:00
parent 0cb9f2cad3
commit a5a926fd94
2 changed files with 32 additions and 0 deletions

View File

@@ -82,6 +82,18 @@ public class FilterJoinNode extends FilterNode {
return new FilterJoinNode(joinClass, joinColumns, column, express, itemand, value);
}
@Override
public FilterJoinNode copy() {
FilterJoinNode node = (FilterJoinNode) copy(new FilterJoinNode());
node.joinClass = this.joinClass;
node.joinEntity = this.joinEntity;
if (this.joinColumns != null) {
node.joinColumns = new String[this.joinColumns.length];
System.arraycopy(this.joinColumns, 0, node.joinColumns, 0, this.joinColumns.length);
}
return node;
}
@Override
protected FilterNode any(final FilterNode node0, boolean signor) {
Objects.requireNonNull(node0);

View File

@@ -82,6 +82,26 @@ public class FilterNode { //FilterNode 不能实现Serializable接口 否则
this.value = val;
}
public FilterNode copy() {
return copy(new FilterNode());
}
protected FilterNode copy(FilterNode node) {
node.readOnly = this.readOnly;
node.column = this.column;
node.express = this.express;
node.value = this.value;
node.itemand = this.itemand;
node.or = this.or;
if (this.nodes != null) {
node.nodes = new FilterNode[this.nodes.length];
for (int i = 0; i < node.nodes.length; i++) {
node.nodes[i] = this.nodes[i] == null ? null : this.nodes[i].copy();
}
}
return node;
}
public FilterNode asReadOnly() {
this.readOnly = true;
return this;