public class UserFactory extends Object
Constructor and Description |
---|
UserFactory()
Create a new empty UserFactory
|
UserFactory(String userFilename)
Create a new UserFactory and fill it with information from a JSON file
|
Modifier and Type | Method and Description |
---|---|
User |
getUser(int index)
Looks for a User with the given id
|
User |
getUser(String name)
Looks for the User with the given name
|
User |
newUser(String name,
int limit)
Adds a new User into this class
|
void |
setUserFileName(String userFilename)
Update the output filename for the object
|
void |
toJsonFile()
Output the data into a JSON file replacing the input file (or if filename not given, "users.json")
|
void |
update(User oldUser,
User newUser)
Replacing a User in the array list with a new User
|
public UserFactory()
public UserFactory(String userFilename)
userFilename
- Name of the input JSON filepublic void toJsonFile()
public void setUserFileName(String userFilename)
userFilename
- The new filenamepublic User newUser(String name, int limit)
name
- Name of the Userlimit
- Limit of Book the User can borrowpublic User getUser(String name)
name
- Name of the User to be foundpublic User getUser(int index)
index
- id of the User to be foundCopyright © 2017. All rights reserved.