Class CustomerService
java.lang.Object
com.goldenleaf.shop.service.CustomerService
Service class for managing
Customer entities.
Provides business logic for retrieving and deleting customers by their mobile number.
Acts as an intermediary between controllers and the CustomerRepository.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newCustomerServicewith the provided repository. -
Method Summary
Modifier and TypeMethodDescriptiongetCustomerByMobile(String mobile) Retrieves aCustomerby their mobile number.voidremoveByMobile(String mobile) Removes aCustomeridentified by their mobile number.
-
Constructor Details
-
CustomerService
Constructs a newCustomerServicewith the provided repository.- Parameters:
repo- the repository used to perform operations on customers- Throws:
IllegalArgumentException- ifrepoisnull- See Also:
-
-
Method Details
-
getCustomerByMobile
Retrieves aCustomerby their mobile number.- Parameters:
mobile- the mobile number of the customer- Returns:
- the
Customerwith the specified mobile number - Throws:
RuntimeException- if no customer with the given mobile number exists- See Also:
-
removeByMobile
Removes aCustomeridentified by their mobile number.- Parameters:
mobile- the mobile number of the customer to delete- Throws:
RuntimeException- if no customer with the given mobile number exists- See Also:
-