• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

The Data() constructor visibility

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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,
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic