Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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,
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic