rt.pipeline.pipe.use.ValidatorInterceptor.xtend Maven / Gradle / Ivy
package rt.pipeline.pipe.use
import rt.pipeline.IComponent
import rt.pipeline.pipe.PipeContext
class ValidatorInterceptor implements IComponent {
override def apply(PipeContext ctx) {
val msg = ctx.message
if(msg.id == null)
ctx.fail(new RuntimeException("No mandatory field 'id'"))
if(msg.cmd == null)
ctx.fail(new RuntimeException("No mandatory field 'cmd'"))
if(msg.clt == null)
ctx.fail(new RuntimeException("No mandatory field 'client'"))
if(msg.path == null)
ctx.fail(new RuntimeException("No mandatory field 'path'"))
ctx.next
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy