diff --git a/net/src/main/java/com/zfoo/net/config/model/NetConfig.java b/net/src/main/java/com/zfoo/net/config/model/NetConfig.java index 254f1c35d..c9af09847 100644 --- a/net/src/main/java/com/zfoo/net/config/model/NetConfig.java +++ b/net/src/main/java/com/zfoo/net/config/model/NetConfig.java @@ -27,7 +27,7 @@ public class NetConfig { /** * {@link GenerateOperation} */ - private boolean oneProtocol; + private boolean mergerProtocol; /** * {@link GenerateOperation} */ @@ -81,12 +81,12 @@ public void setProtocolLocation(String protocolLocation) { this.protocolLocation = protocolLocation; } - public boolean isOneProtocol() { - return oneProtocol; + public boolean isMergerProtocol() { + return mergerProtocol; } - public void setOneProtocol(boolean oneProtocol) { - this.oneProtocol = oneProtocol; + public void setMergerProtocol(boolean mergerProtocol) { + this.mergerProtocol = mergerProtocol; } public boolean isFoldProtocol() { diff --git a/net/src/main/java/com/zfoo/net/packet/PacketService.java b/net/src/main/java/com/zfoo/net/packet/PacketService.java index fa70c22d9..687b00eff 100644 --- a/net/src/main/java/com/zfoo/net/packet/PacketService.java +++ b/net/src/main/java/com/zfoo/net/packet/PacketService.java @@ -92,7 +92,7 @@ public void init() { var protocolLocation = netConfig.getProtocolLocation(); var generateOperation = new GenerateOperation(); - generateOperation.setMergeProtocol(netConfig.isOneProtocol()); + generateOperation.setMergeProtocol(netConfig.isMergerProtocol()); generateOperation.setFoldProtocol(netConfig.isFoldProtocol()); generateOperation.setProtocolPath(netConfig.getProtocolPath()); generateOperation.setProtocolParam(netConfig.getProtocolParam()); diff --git a/net/src/main/java/com/zfoo/net/schema/NetDefinitionParser.java b/net/src/main/java/com/zfoo/net/schema/NetDefinitionParser.java index 0a506b9e7..a92557c3f 100644 --- a/net/src/main/java/com/zfoo/net/schema/NetDefinitionParser.java +++ b/net/src/main/java/com/zfoo/net/schema/NetDefinitionParser.java @@ -102,7 +102,7 @@ private void parseNetConfig(Element element, ParserContext parserContext) { resolvePlaceholder("protocol-location", "protocolLocation", builder, element, parserContext); // 协议文件是否生成在同一个协议文件中 - resolvePlaceholder("one-protocol", "oneProtocol", builder, element, parserContext); + resolvePlaceholder("merger-protocol", "mergerProtocol", builder, element, parserContext); // 文件是否折叠 resolvePlaceholder("fold-protocol", "foldProtocol", builder, element, parserContext); // 生成各种语言的协议列表 diff --git a/net/src/main/resources/net-1.0.xsd b/net/src/main/resources/net-1.0.xsd index caa289663..49beda8a2 100644 --- a/net/src/main/resources/net-1.0.xsd +++ b/net/src/main/resources/net-1.0.xsd @@ -65,7 +65,7 @@ - + diff --git a/protocol/src/main/java/com/zfoo/protocol/serializer/ICodeGenerate.java b/protocol/src/main/java/com/zfoo/protocol/serializer/ICodeGenerate.java index 8538f5836..bae9c61e7 100644 --- a/protocol/src/main/java/com/zfoo/protocol/serializer/ICodeGenerate.java +++ b/protocol/src/main/java/com/zfoo/protocol/serializer/ICodeGenerate.java @@ -13,10 +13,19 @@ public interface ICodeGenerate { void init(GenerateOperation generateOperation); + /** + * 将一个包下的协议文件生成在一个协议文件里 + */ void mergerProtocol(List registrations) throws IOException; + /** + * 折叠协议,生成协议文件会和Java源文件保持相同的目录结构 + */ void foldProtocol(List registrations) throws IOException; + /** + * 默认把所有的协议文件放在同一个更目录下,不做任何操作 + */ void defaultProtocol(List registrations) throws IOException; }