Skip to content

Commit

Permalink
ref[kotlin]: refactor kotlin protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 7, 2024
1 parent fdb37c5 commit 6c84df8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void mergerProtocol(List<ProtocolRegistration> registrations) throws IOEx
for (var registration : registrations) {
var protocol_id = registration.protocolId();
var protocol_name = registration.protocolConstructor().getDeclaringClass().getSimpleName();
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = Registration{}()", protocol_id, protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = {}Registration()", protocol_id, protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocolIdMap.put({}::class.java, {})", protocol_name, protocol_id)).append(LS);
}

Expand Down Expand Up @@ -137,8 +137,8 @@ public void foldProtocol(List<ProtocolRegistration> registrations) throws IOExce
var protocol_id = registration.protocolId();
var protocol_name = registration.protocolConstructor().getDeclaringClass().getSimpleName();
protocol_imports.append(StringUtils.format("import {}.{}.{}", protocolPackage, GenerateProtocolPath.protocolPathPeriod(protocol_id), protocol_name)).append(LS);
protocol_imports.append(StringUtils.format("import {}.{}.Registration{}", protocolPackage, GenerateProtocolPath.protocolPathPeriod(protocol_id), protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = Registration{}()", protocol_id, protocol_name)).append(LS);
protocol_imports.append(StringUtils.format("import {}.{}.{}Registration", protocolPackage, GenerateProtocolPath.protocolPathPeriod(protocol_id), protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = {}Registration()", protocol_id, protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocolIdMap[{}::class.java] = {}.toShort()", protocol_name, protocol_id)).append(LS);
}

Expand Down Expand Up @@ -178,7 +178,7 @@ public void defaultProtocol(List<ProtocolRegistration> registrations) throws IOE
for (var registration : registrations) {
var protocol_id = registration.protocolId();
var protocol_name = registration.protocolConstructor().getDeclaringClass().getSimpleName();
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = Registration{}()", protocol_id, protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocols[{}] = {}Registration()", protocol_id, protocol_name)).append(LS);
protocol_manager_registrations.append(StringUtils.format("protocolIdMap[{}::class.java] = {}.toShort()", protocol_name, protocol_id)).append(LS);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Registration${protocol_name} : IProtocolRegistration {
class ${protocol_name}Registration : IProtocolRegistration {
override fun protocolId(): Short {
return ${protocol_id}
}
Expand Down

0 comments on commit 6c84df8

Please sign in to comment.