Text

Deprecation-Pattern

Do you know the situation: Implementing public getters, setters or default constructors for certain frameworks. 

There are many cases for which you won’t implement such possible sources of defect.

So what I do when I want to prevent other developers to use such technical required methods is to mark them as deprecated.

Example:

public class Person {

    /**      
     * @deprecated only for framework XY      
     */     
    @Deprecated     
    public Person() {}       

    public Person(String firstName, String lastName) 
    {
      
    } 
}