mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-23 00:25:38 +00:00
ref[csharp]: refactor generate csharp protocol
This commit is contained in:
@@ -27,7 +27,7 @@ public class NetConfig {
|
||||
/**
|
||||
* {@link GenerateOperation}
|
||||
*/
|
||||
private boolean oneProtocol;
|
||||
private boolean mergerProtocol;
|
||||
/**
|
||||
* {@link GenerateOperation}
|
||||
*/
|
||||
@@ -81,12 +81,12 @@ public class NetConfig {
|
||||
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() {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PacketService implements IPacketService {
|
||||
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());
|
||||
|
||||
@@ -102,7 +102,7 @@ public class NetDefinitionParser implements BeanDefinitionParser {
|
||||
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);
|
||||
// 生成各种语言的协议列表
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="protocol-location" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="one-protocol" type="xsd:boolean" default="false"/>
|
||||
<xsd:attribute name="merger-protocol" type="xsd:boolean" default="false"/>
|
||||
<xsd:attribute name="fold-protocol" type="xsd:boolean" default="false"/>
|
||||
<xsd:attribute name="code-languages" type="xsd:string"/>
|
||||
<xsd:attribute name="protocol-path" type="xsd:string"/>
|
||||
|
||||
@@ -13,10 +13,19 @@ public interface ICodeGenerate {
|
||||
|
||||
void init(GenerateOperation generateOperation);
|
||||
|
||||
/**
|
||||
* 将一个包下的协议文件生成在一个协议文件里
|
||||
*/
|
||||
void mergerProtocol(List<IProtocolRegistration> registrations) throws IOException;
|
||||
|
||||
/**
|
||||
* 折叠协议,生成协议文件会和Java源文件保持相同的目录结构
|
||||
*/
|
||||
void foldProtocol(List<IProtocolRegistration> registrations) throws IOException;
|
||||
|
||||
/**
|
||||
* 默认把所有的协议文件放在同一个更目录下,不做任何操作
|
||||
*/
|
||||
void defaultProtocol(List<IProtocolRegistration> registrations) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user