Package com.pusher.client.util
Class Factory
- java.lang.Object
-
- com.pusher.client.util.Factory
-
public class Factory extends java.lang.Object
This is a lightweight way of doing dependency injection and enabling classes to be unit tested in isolation. No class in this library instantiates another class directly, otherwise they would be tightly coupled. Instead, they all call the factory methods in this class when they want to create instances of another class.An instance of Factory is provided on construction to each class which may require it, the initial factory is instantiated in the Pusher constructor, the only constructor which a library consumer should need to call directly.
Conventions:
- any method that starts with "new", such as
newPublicChannel(String)creates a new instance of that class every time it is called.
-
-
Constructor Summary
Constructors Constructor Description Factory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pusher.client.channel.impl.ChannelManagergetChannelManager()com.pusher.client.connection.impl.InternalConnectiongetConnection(java.lang.String apiKey, PusherOptions options, java.util.function.Consumer<PusherEvent> eventHandler)java.util.concurrent.ScheduledExecutorServicegetTimers()com.pusher.client.channel.impl.PresenceChannelImplnewPresenceChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)com.pusher.client.channel.impl.PrivateChannelImplnewPrivateChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)com.pusher.client.channel.impl.PrivateEncryptedChannelImplnewPrivateEncryptedChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)com.pusher.client.channel.impl.ChannelImplnewPublicChannel(java.lang.String channelName)InternalUsernewUser(com.pusher.client.connection.impl.InternalConnection connection, UserAuthenticator userAuthenticator)com.pusher.client.connection.websocket.WebSocketClientWrappernewWebSocketClientWrapper(java.net.URI uri, java.net.Proxy proxy, com.pusher.client.connection.websocket.WebSocketListener webSocketListener)voidqueueOnEventThread(java.lang.Runnable r)voidshutdownThreads()
-
-
-
Constructor Detail
-
Factory
public Factory()
-
-
Method Detail
-
getConnection
public com.pusher.client.connection.impl.InternalConnection getConnection(java.lang.String apiKey, PusherOptions options, java.util.function.Consumer<PusherEvent> eventHandler)
-
newWebSocketClientWrapper
public com.pusher.client.connection.websocket.WebSocketClientWrapper newWebSocketClientWrapper(java.net.URI uri, java.net.Proxy proxy, com.pusher.client.connection.websocket.WebSocketListener webSocketListener) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
getTimers
public java.util.concurrent.ScheduledExecutorService getTimers()
-
newPublicChannel
public com.pusher.client.channel.impl.ChannelImpl newPublicChannel(java.lang.String channelName)
-
newPrivateChannel
public com.pusher.client.channel.impl.PrivateChannelImpl newPrivateChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)
-
newPrivateEncryptedChannel
public com.pusher.client.channel.impl.PrivateEncryptedChannelImpl newPrivateEncryptedChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)
-
newPresenceChannel
public com.pusher.client.channel.impl.PresenceChannelImpl newPresenceChannel(com.pusher.client.connection.impl.InternalConnection connection, java.lang.String channelName, ChannelAuthorizer channelAuthorizer)
-
newUser
public InternalUser newUser(com.pusher.client.connection.impl.InternalConnection connection, UserAuthenticator userAuthenticator)
-
getChannelManager
public com.pusher.client.channel.impl.ChannelManager getChannelManager()
-
queueOnEventThread
public void queueOnEventThread(java.lang.Runnable r)
-
shutdownThreads
public void shutdownThreads()
-
-