Module it.auties.cobalt
Package it.auties.whatsapp.controller
Class Controller<T extends Controller<T>>
java.lang.Object
it.auties.whatsapp.controller.Controller<T>
- All Implemented Interfaces:
it.auties.protobuf.model.ProtobufMessage,it.auties.protobuf.model.ProtobufObject
public abstract sealed class Controller<T extends Controller<T>>
extends Object
implements it.auties.protobuf.model.ProtobufMessage
permits Store, Keys
This interface represents is implemented by all WhatsappWeb4J's controllers. It provides an easy
way to store IDs and serialize said class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Collection<String> A list of alias for the controller, can be used in place of UUID1protected final ClientTypeThe client typeprivate PhoneNumberThe phone number of the associated companionprotected ControllerSerializerThe serializer instance to useprotected final UUIDThe id of this controller -
Constructor Summary
ConstructorsConstructorDescriptionController(UUID uuid, PhoneNumber phoneNumber, ControllerSerializer serializer, ClientType clientType, Collection<String> alias) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an alias to this controlleralias()Returns an immutable collection of aliasvoidDeletes the current sessionabstract voiddispose()Disposes this objectReturns the phone number of this controllervoidRemoves all alias from this controllervoidremoveAlias(String entry) Removes an alias to this controllerabstract voidserialize(boolean async) Serializes this objectReturns the serializersetPhoneNumber(PhoneNumber phoneNumber) Sets the phone number used by this sessionsetSerializer(ControllerSerializer serializer) Sets the serializer of this controllertoJson()Converts this controller to a json.uuid()
-
Field Details
-
uuid
The id of this controller -
phoneNumber
The phone number of the associated companion -
serializer
The serializer instance to use -
clientType
The client type -
alias
A list of alias for the controller, can be used in place of UUID1
-
-
Constructor Details
-
Controller
public Controller(UUID uuid, PhoneNumber phoneNumber, ControllerSerializer serializer, ClientType clientType, Collection<String> alias)
-
-
Method Details
-
serialize
public abstract void serialize(boolean async) Serializes this object- Parameters:
async- whether the operation should be executed asynchronously
-
dispose
public abstract void dispose()Disposes this object -
uuid
-
clientType
-
phoneNumber
Returns the phone number of this controller- Returns:
- an optional
-
setPhoneNumber
Sets the phone number used by this session- Returns:
- the same instance
-
serializer
Returns the serializer- Returns:
- a non-null serializer
-
setSerializer
Sets the serializer of this controller- Parameters:
serializer- a serializer- Returns:
- the same instance
-
alias
Returns an immutable collection of alias- Returns:
- an immutable collection
-
addAlias
Adds an alias to this controller- Parameters:
entry- the non-null alias to add
-
removeAlias
Removes an alias to this controller- Parameters:
entry- the non-null alias to remove
-
removeAlias
public void removeAlias()Removes all alias from this controller -
toJson
Converts this controller to a json. Useful when debugging.- Returns:
- a non-null string
-
deleteSession
public void deleteSession()Deletes the current session
-