-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2435 from hongwei1/refactor/cleanConnectorTrait
Refactor/clean connector trait
- Loading branch information
Showing
20 changed files
with
22,800 additions
and
8,126 deletions.
There are no files selected for viewing
49 changes: 0 additions & 49 deletions
49
obp-api/src/main/scala/code/bankconnectors/CommonsCaseClassGenerator.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
obp-api/src/main/scala/code/bankconnectors/akka/AkkaConnectorBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
obp-api/src/main/scala/code/bankconnectors/generator/CommonsCaseClassGenerator.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package code.bankconnectors.generator | ||
|
||
import code.bankconnectors.generator.ConnectorBuilderUtil._ | ||
|
||
import scala.reflect.runtime.{universe => ru} | ||
|
||
object CommonsCaseClassGenerator extends App { | ||
|
||
val returnModels: Iterable[ru.Type] = connectorDeclsMethodsReturnOBPRequiredType | ||
.map(it => it.asMethod.returnType) | ||
.filter(it => { | ||
val symbol = it.typeSymbol | ||
val isAbstract = symbol.isAbstract | ||
isAbstract //Depends here, maybe no need this guard for some commons classes. | ||
}) | ||
.toSet | ||
|
||
returnModels.map(_.typeSymbol.fullName).foreach(it => println(s"import $it")) | ||
|
||
def mkClass(tp: ru.Type) = { | ||
val varibles = tp.decls.map(it => s"${it.name} :${it.typeSignature.typeSymbol.name}").mkString(", \n ") | ||
|
||
s""" | ||
|case class ${tp.typeSymbol.name}Commons( | ||
| $varibles) extends ${tp.typeSymbol.name} | ||
|object ${tp.typeSymbol.name}Commons extends Converter[${tp.typeSymbol.name}, ${tp.typeSymbol.name}Commons] | ||
""".stripMargin | ||
} | ||
// private val str: String = ru.typeOf[Bank].decls.map(it => s"${it.name} :${it.typeSignature.typeSymbol.name}").mkString(", \n") | ||
returnModels.map(mkClass).foreach(println) | ||
println() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
obp-api/src/main/scala/code/bankconnectors/rabbitmq/RabbitMQConnectorBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
obp-api/src/main/scala/code/bankconnectors/rest/RestConnectorBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.