• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Data() constructor visibility

 
Olivier Gregoire
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears,


I'm implementing some kind of mega-factory for some design reason I prefer, and in this scope, I would like to "force" the use of the factory, including for the Data class. So I'm thinking about setting the Data() constructor visibility to package-private. I haven't read anything about the requirement of the constructor Data() being public.

So my questions is: did any of the implementors of the singleton pattern for Data set the default constructor to anything else than public and still scored a perfect for that data access part?


Thank you,
Olivier
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Olivier,

I marked the default constructor (which is the only constructor I have in Data class) even as private. This was of course needed for a correct implementation of singleton pattern. So i guess package-private won't be a problem too.

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic