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