All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.touk.nussknacker.ui.definition.scenarioproperty.ScenarioPropertyValidatorDeterminerChain.scala Maven / Gradle / Ivy

There is a newer version: 1.17.0
Show newest version
package pl.touk.nussknacker.ui.definition.scenarioproperty

import pl.touk.nussknacker.engine.api.definition.ParameterValidator
import pl.touk.nussknacker.engine.api.component.ScenarioPropertyConfig

object ScenarioPropertyValidatorDeterminerChain {

  def apply(config: ScenarioPropertyConfig): ScenarioPropertyValidatorsDeterminerChain = {
    val strategies = Seq(
      new ScenarioPropertyConfigValidatorDeterminer(config),
      new ScenarioPropertyEditorValidatorDeterminer(config.editor)
    )
    new ScenarioPropertyValidatorsDeterminerChain(strategies)
  }

}

class ScenarioPropertyValidatorsDeterminerChain(strategies: Iterable[ScenarioPropertyValidatorDeterminer]) {

  def determine(): List[ParameterValidator] = {
    strategies.view
      .flatMap(_.determine())
      .headOption
      .getOrElse(List.empty)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy