How to mark a method obligatory?

后端 未结 6 550
囚心锁ツ
囚心锁ツ 2020-12-30 10:21

Suppose you create a class names Person using the builder pattern, and suppose the Builder class contains methods body(), head(), arms()

6条回答
  •  無奈伤痛
    2020-12-30 10:57

    Maybe inside of build() you could check if all the required methods have been called. Behaps the Person instance has some internal sanity check which is triggered by build().

    Of course this checks runtime behaviour and is no static analysis as you describe it.

提交回复
热议问题