-
-
Save le0nidas/68313941ca058f7799c0d83969402538 to your computer and use it in GitHub Desktop.
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
abstract class BaseAction( | |
private val nextAction: Action? | |
) : Action { | |
override fun execute(response: Response) { | |
nextAction?.execute(response) | |
} | |
} | |
class Print : Action { | |
override val name: String = "print" | |
override fun execute(response: Response) { | |
println("printing ${response.value}...") | |
} | |
} | |
class PrintInErrorStream( | |
nextAction: Action? | |
) : BaseAction(nextAction) { | |
override val name: String = "print" | |
override fun execute(response: Response) { | |
if (response.isError) { | |
System.err.println("printing (in error stream) ${response.value}...") | |
return | |
} | |
super.execute(response) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment