public class Config
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALREADY_A_FRIEND
This is shown if the nickname is already a friend
|
static java.lang.String |
ALREADY_PRESENT
This is shown if the supplied nickname is already present in the
broadcast list
|
static java.lang.String |
BCAST_LIST_DOES_NOT_EXIST
This is shown if the broadcast list on which some operation is to be
performed does not exist
|
static java.lang.String |
CANT_ADD_YOURSELF_TO_BCAST
This is shown if trying to add the user to one of his own broadcast lists
|
static java.lang.String |
CANT_BE_EMPTY_OR_NULL
Encapsulate this string inside most instances of WhatsAppRuntimeException
|
static java.lang.String |
CANT_BE_OWN_FRIEND
This is shown if trying to add the user as his own friend
|
static java.lang.String |
CANT_LOCATE
This is shown if you cannot locate the nickname supplied for various
operations.
|
static java.lang.String |
CANT_SEND_YOURSELF
This is shown if trying to send a message to the same user
|
static java.lang.String |
ENTER_COMMAND
This is the prompt for the logged in user to enter a command
|
static java.lang.String |
ERROR_IO
This is shown if some error occurs while reading the input file
|
static java.lang.String |
EXITING
Show this just before exiting the program when the exit: command is
issued
|
static java.lang.String |
FILE_DOES_NOT_EXIST
This is shown if the input file does not exist
|
static java.lang.String |
INVALID_COMMAND
This is shown when the entered command is not valid
|
static java.lang.String |
INVALID_CREDENTIALS
This is shown if the nickname/password pair is incorrect
|
static java.lang.String |
LOGIN_PROMPT
This is shown to the logged in user for getting a command
|
static java.lang.String |
MESSAGE_FORMAT
This is the message template to be used in read message commands
|
static java.lang.String |
MESSAGE_SENT_SUCCESSFULLY
This is shown when a message is sent successfully to the intended
receiver(s)
|
static java.lang.String |
NICKNAME_DOES_NOT_EXIST
This is shown if the nickname is not an existing global contact
|
static java.lang.String |
NO_MESSAGES
This is shown if there are no messages to be shown as a result of any of
the read messages commands
|
static java.lang.String |
NO_RESULTS_FOUND
This is shown for search commands when they show no users that match the
search criteria
|
static java.lang.String |
NOT_A_FRIEND
This is shown if the supplied nickname is not a friend
|
static java.lang.String |
NOT_PART_OF_BCAST_LIST
This is shown if the user nickname is not a member of the broadcast list
nickname
|
static java.lang.String |
PASSWORD_PROMPT
This is shown to get the password while login
|
static java.lang.String |
SOMETHING_EXISTS
This is shown if another user with the same nickname already exists
|
static java.lang.String |
SUCCESSFULLY_ADDED
This is shown as part of various add operations that may be performed as
part of commands
|
static java.lang.String |
SUCCESSFULLY_LOGGED_IN
This is shown if the user provides valid credentials
|
static java.lang.String |
SUCCESSFULLY_LOGGED_OUT
This is shown after a logout: command is issued by a logged in user
|
static java.lang.String |
SUCCESSFULLY_REMOVED
This is shown as part of various removal operations that may be performed
as part of commands
|
static java.lang.String |
USAGE
This is the usage string to be shown if the number of command line
arguments is not exactly one
|
static java.lang.String |
USER_DISPLAY_FOR_SEARCH
This is used as a template while showing user information for search
commands
|
Modifier and Type | Method and Description |
---|---|
java.util.List<User> |
getAllUsers()
returns the list of the global contacts
|
java.util.Scanner |
getConsoleInput()
returns the only way you can obtain input from the keyboard (its a
Scanner)
|
java.io.PrintStream |
getConsoleOutput()
returns the only way you can write output to screen (its a PrintStream)
|
User |
getCurrentUser()
returns the currently logged in user object
|
static Config |
getInstance()
This static method is used to return the only instance existing for the
Config class
|
void |
setAllUsers(java.util.List<User> allUsers)
sets the list of global users
|
void |
setConsoleInput(java.util.Scanner consoleInput)
a setter for the Scanner object that should be used to obtain input from
the keyboard
|
void |
setConsoleOutput(java.io.PrintStream consoleOutput)
a setter for the PrintStream object that should be used to write to the
screen
|
void |
setCurrentUser(User currentUser)
sets the currently logged in user object.
|
public static final java.lang.String ALREADY_A_FRIEND
public static final java.lang.String ALREADY_PRESENT
public static final java.lang.String BCAST_LIST_DOES_NOT_EXIST
public static final java.lang.String CANT_ADD_YOURSELF_TO_BCAST
public static final java.lang.String CANT_BE_EMPTY_OR_NULL
public static final java.lang.String CANT_BE_OWN_FRIEND
public static final java.lang.String CANT_LOCATE
public static final java.lang.String CANT_SEND_YOURSELF
public static final java.lang.String ENTER_COMMAND
public static final java.lang.String ERROR_IO
public static final java.lang.String EXITING
public static final java.lang.String FILE_DOES_NOT_EXIST
public static final java.lang.String INVALID_COMMAND
public static final java.lang.String INVALID_CREDENTIALS
public static final java.lang.String LOGIN_PROMPT
public static final java.lang.String MESSAGE_FORMAT
public static final java.lang.String MESSAGE_SENT_SUCCESSFULLY
public static final java.lang.String NICKNAME_DOES_NOT_EXIST
public static final java.lang.String NOT_A_FRIEND
public static final java.lang.String NOT_PART_OF_BCAST_LIST
public static final java.lang.String NO_MESSAGES
public static final java.lang.String NO_RESULTS_FOUND
public static final java.lang.String PASSWORD_PROMPT
public static final java.lang.String SOMETHING_EXISTS
public static final java.lang.String SUCCESSFULLY_ADDED
public static final java.lang.String SUCCESSFULLY_LOGGED_IN
public static final java.lang.String SUCCESSFULLY_LOGGED_OUT
public static final java.lang.String SUCCESSFULLY_REMOVED
public static final java.lang.String USAGE
public static final java.lang.String USER_DISPLAY_FOR_SEARCH
public static Config getInstance()
public User getCurrentUser()
public void setCurrentUser(User currentUser)
currentUser
- the currently logged in user object. set this to null
while logging outpublic java.util.List<User> getAllUsers()
public void setAllUsers(java.util.List<User> allUsers)
allUsers
- the list of all users in WhatsApppublic java.util.Scanner getConsoleInput()
public void setConsoleInput(java.util.Scanner consoleInput)
consoleInput
- the Scanner to be used to obtain inputpublic java.io.PrintStream getConsoleOutput()
public void setConsoleOutput(java.io.PrintStream consoleOutput)
consoleOutput
- the PrintStream to be used to write the screen