@Override public OperationProcessingChain getOperationProcessingChain() { if (super.getOperationProcessingChain() != null) { return super.getOperationProcessingChain(); } RequestRouter myRouter = new RequestRouter(); myRouter.register( Action.PATCH, new RequestRouter.RequestBodyMatcher<BankAccountServiceRequest>( BankAccountServiceRequest.class, "kind", BankAccountServiceRequest.Kind.DEPOSIT), this::handlePatchForDeposit, "Deposit"); myRouter.register( Action.PATCH, new RequestRouter.RequestBodyMatcher<BankAccountServiceRequest>( BankAccountServiceRequest.class, "kind", BankAccountServiceRequest.Kind.WITHDRAW), this::handlePatchForWithdraw, "Withdraw"); OperationProcessingChain opProcessingChain = new OperationProcessingChain(this); opProcessingChain.add(new TransactionalRequestFilter(this)); opProcessingChain.add(myRouter); setOperationProcessingChain(opProcessingChain); return opProcessingChain; }
@Override public OperationProcessingChain getOperationProcessingChain() { if (super.getOperationProcessingChain() != null) { return super.getOperationProcessingChain(); } RequestRouter myRouter = new RequestRouter(); myRouter.register( Action.PATCH, new RequestRouter.RequestBodyMatcher<>(EnrollRequest.class, "kind", EnrollRequest.KIND), this::handlePatchForEnroll, "Register service"); myRouter.register( Action.PATCH, new RequestRouter.RequestBodyMatcher<>( EndTransactionRequest.class, "kind", EndTransactionRequest.KIND), this::handlePatchForEndTransaction, "Commit or abort transaction"); OperationProcessingChain opProcessingChain = new OperationProcessingChain(this); opProcessingChain.add(myRouter); setOperationProcessingChain(opProcessingChain); return opProcessingChain; }