how can i explain java uml to a class that has all the characteristics of a umlclass to a

It seems like this class has an instance of itself as a private static property

this is visibly a singleton => only one instance memorized through that property

(how should I instantiate it ? In the constructor ?)

it is instantiated the first time getProvider is called

The constructor is private

of course, it must not be called from outside

I don’t know what I should put inside it since the 2 properties are static anyway

in any case weatherProvider must be set to memorize the alone instance, that can be done in the constructor or in getProvider, knowing the constructor is called when weatherProvider is null (default value)

Look at singleton implementation

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top