Suppose you create a class names Person using the builder pattern, and suppose the Builder class contains methods body()
, head()
, arms()
and of course build()
and you consider methods head()
and build()
obligatory for the user of this class.
We would like to somehow mark these methods obligatory, if possible using annotations. If a user of this class tries to build a Person instance but forgot to call either of these methods, we would like to get some kind of warning - either from the java compiler, or maybe from Eclipse or Maven, which we use to build our projects - any of them would do.
Is it possible to do? Which way would you suggest?