Pattern to restrict from using default constructor
843830Jul 3 2009 — edited Jul 4 2009I have a Class with a protected constructor that gets created by a factory method. For using an Object of this Class as a bean i need a default constructor.
My bean is used in a JSP page and gets created in a servlet previously by a factory object.
I didn't find a solution to omit the default constructor.
What is the prefered way to forbid use of the default constructor? I thought about throwing a runtime exception. But I don't really know java and it's patterns so I'll love every better solution