Design pattern for default implementation with empty methods

前端 未结 9 1325
余生分开走
余生分开走 2021-02-02 11:32

Is there a specific design pattern that describes the scenario where a non-abstract default implementation is provided that implements all or some of the method

9条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 12:07

    I have seen this design used in spring where they have a class named FlowExecutionListenerAdapter which saves you implementing all the FlowExecutionListener operations.

    However, it does sound like the Null Object Pattern too. However I feel it sits better in the Adapter world purely because it changing the behavour of the interface by allowing you only to implement the bit you want...but its a tough one.

    I'm sure this question has been asked before?

    This sounds similar no? might be worth a read.

提交回复
热议问题