You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/12 19:26:20 UTC

[GitHub] andrewfayres commented on a change in pull request #13159: [MXNET-1202] Change Builder class into a better way

andrewfayres commented on a change in pull request #13159: [MXNET-1202] Change Builder class into a better way
URL: https://github.com/apache/incubator-mxnet/pull/13159#discussion_r232779598
 
 

 ##########
 File path: scala-package/macros/src/main/scala/org/apache/mxnet/APIDocGenerator.scala
 ##########
 @@ -203,27 +201,61 @@ private[mxnet] object APIDocGenerator{
   }
 
   def generateJavaAPISignature(func : absClassFunction) : String = {
+    val useParamObject = func.listOfArgs.count(arg => arg.isOptional) >= 2
     var argDef = ListBuffer[String]()
     var classDef = ListBuffer[String]()
+    var requiredParam = ListBuffer[String]()
     func.listOfArgs.foreach(absClassArg => {
       val currArgName = safetyNameCheck(absClassArg.argName)
       // scalastyle:off
-      if (absClassArg.isOptional) {
-        classDef += s"def set${absClassArg.argName}(${absClassArg.argName} : ${absClassArg.argType}) : ${func.name}BuilderBase"
+      if (absClassArg.isOptional && useParamObject) {
+        classDef +=
+          s"""private var $currArgName: ${absClassArg.argType} = null
+             |/**
+             | * @param $currArgName\t\t${absClassArg.argDesc}
+             | */
+             |def set${currArgName.capitalize}($currArgName : ${absClassArg.argType}): ${func.name}Param = {
 
 Review comment:
   Nitpick: The spacing is off in the generated code for the comments and the def. If you push any other change please add indention here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services