package singleton;
/**
* @author mario
* Implemented as a Singleton
*/
public class MyOnlyInstance {
/** Contains the singleton instance of this class. */
protected static MyOnlyInstance s_instance;
protected String m_info;
private MyOnlyInstance() {
super();
}
/**
* Returns a new instance of the MyOnlyInstance
class. As this
* class is implemented as a singleton, calls to this method always return the
* same MyOnlyInstance
instance.
*
* @return the singleton instance of the MyOnlyInstance
.
*/
public static MyOnlyInstance getInstance() {
if (s_instance == null) {
s_instance = new MyOnlyInstance();
}
return s_instance;
}
public String getInfo() {
return m_info;
}
public void setInfo(String info) {
m_info = info;
}
}