public class StorageService extends Object
| Constructor and Description |
|---|
StorageService() |
| Modifier and Type | Method and Description |
|---|---|
static ContactCard |
addContact(ContactCard contact)
Adds a contact into the storage.
|
static List<ContactCard> |
clear()
Removes all contacts from the storage.
|
static List<ContactCard> |
findByEmail(String emailPart)
Finds contacts whose email contains
emailPart as a substring. |
static List<ContactCard> |
findByName(String namePart)
Finds contacts whose name contains
namePart as a substring. |
static List<ContactCard> |
findByPhone(String phonePart)
Finds contacts whose phone contains
phonePart as a substring. |
static ContactCard |
get(Long id)
Retrieves contact with given
id. |
static ContactCard |
remove(Long id)
Removes contact with given
id. |
public static ContactCard addContact(ContactCard contact)
null value is returned.contact - contact to be added.id field, null if the contact already exist in the storage.public static List<ContactCard> clear()
public static ContactCard remove(Long id)
id.id - id of the contact to be removed.null if the contact is not present in the storage.public static ContactCard get(Long id)
id.id - id of the contact to be retrieved.null if the contact is not present in the storage.public static List<ContactCard> findByEmail(String emailPart)
emailPart as a substring.emailPart - search phrase.public static List<ContactCard> findByName(String namePart)
namePart as a substring.namePart - search phrase.public static List<ContactCard> findByPhone(String phonePart)
phonePart as a substring.phonePart - search phrase.Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.