chitralverma commented on a change in pull request #558: [WIP] Enum based 
configs
URL: https://github.com/apache/griffin/pull/558#discussion_r355861245
 
 

 ##########
 File path: 
measure/src/main/scala/org/apache/griffin/measure/configuration/dqdefinition/DQConfig.scala
 ##########
 @@ -154,8 +154,8 @@ case class RuleParam(@JsonProperty("dsl.type") private val 
dslType: String,
                      @JsonProperty("out") private val outputs: 
List[RuleOutputParam] = null,
                      @JsonProperty("error.confs") private val errorConfs: 
List[RuleErrorConfParam] = null
                     ) extends Param {
-  def getDslType: DslType = if (dslType != null) DslType(dslType) else 
DslType("")
-  def getDqType: DqType = if (dqType != null) DqType(dqType) else DqType("")
+  def getDslType: DslType.DslType = if (dslType != null) 
DslType.withNameWithDefault(dslType) else DslType.GriffinDsl
+  def getDqType: DqType.DqType = if (dqType != null) 
DqType.withNameWithDefault(dqType) else DqType.Unknown
 
 Review comment:
   @tusharpatil20 setting the default values directly in the case class can 
eliminate the if else null check.
   
   for example:
   ```
   case class RuleParam(@JsonProperty("dsl.type") private val dslType: String = 
DslType.GriffinDsl.toString ,
   ....
   )
   ```
   correspondingly, 
   
   ```
   def getDslType: DslType.DslType = DslType.withNameWithDefault(dslType)
   ```
   
   This can be followed in other places as well. Ideally Option[T] should be 
used.

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


With regards,
Apache Git Services

Reply via email to