package de.thedevstack.conversationsplus.utils; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.services.XmppConnectionService; /** * Accessor utility to access XmppConnectionService without having to pass the XmppConnectionService every time. */ public final class XmppConnectionServiceAccessor { public static XmppConnectionService xmppConnectionService; /** * Initializes the XmppConnectionService. * This method needs to be called once in XmppConnectionService#onCreate. * @param xmppConnectionService */ public static void initXmppConnectionService(XmppConnectionService xmppConnectionService) { if (null == XmppConnectionServiceAccessor.xmppConnectionService) { XmppConnectionServiceAccessor.xmppConnectionService = xmppConnectionService; } else { Logging.e("XmppConnectionServiceAccessor", "XMPP Connection Service already instantiated."); } } /** * Avoid instantiation */ private XmppConnectionServiceAccessor() { // avoid instantiation } }