Skip to Content
0
Nov 30, 2005 at 09:16 AM

Singleton Controller

28 Views

Hi all,

I want to make a component controller class as Singleton, as I want it to have have only instance. Normal procedure for the same is as follows :-

// Singleton with final field

public class Elvis {

public static final Elvis INSTANCE = new Elvis();

private Elvis() {

...

}

... // Remainder omitted

}

But the class of the component controller looks some thing like the following :-

public class SingletonController

{

public SingletonController(IPrivateSingletonController wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

.....

....

}

Even if i change the constructor to Private, it automatically changes it back to Public.

Please help me in doing this.

Regards,

Narahari