Index
All Classes and Interfaces|All Packages|Serialized Form
C
- com.example.springrest - package com.example.springrest
-
Application root package for the Spring Boot backend.
- com.example.springrest.config - package com.example.springrest.config
-
Application-wide configuration classes.
- com.example.springrest.controllers - package com.example.springrest.controllers
-
REST controllers that define the public API of the application.
- com.example.springrest.dto - package com.example.springrest.dto
-
Data Transfer Objects (DTOs) for the Product API.
- com.example.springrest.exceptions - package com.example.springrest.exceptions
-
This package defines custom exceptions for the application.
- com.example.springrest.mappers - package com.example.springrest.mappers
-
Provides MapStruct-based mappers for converting between domain entities and Data Transfer Objects (DTOs).
- com.example.springrest.models - package com.example.springrest.models
-
JPA Entities that represent the core domain model of the application.
- com.example.springrest.repositories - package com.example.springrest.repositories
-
This package contains the repository interfaces for the application.
- com.example.springrest.services - package com.example.springrest.services
-
This package contains the service layer of the application.
- Configuration - Search tag in class com.example.springrest.config.CorsConfig
- Section
- Conventions - Search tag in package com.example.springrest
- Section
- CorsConfig - Class in com.example.springrest.config
-
Configuration class for Cross-Origin Resource Sharing (CORS).
- CorsConfig() - Constructor for class com.example.springrest.config.CorsConfig
- corsConfigurer() - Method in class com.example.springrest.config.CorsConfig
-
Defines the
WebMvcConfigurer
bean that applies global CORS mappings. - create(ProductRequest) - Method in class com.example.springrest.controllers.ProductController
-
Creates a new product.
- create(Product) - Method in class com.example.springrest.services.ProductService
-
Creates/Persists a new product
- Current Repositories - Search tag in package com.example.springrest.repositories
- Section
D
- delete(Long) - Method in class com.example.springrest.controllers.ProductController
-
Deletes a product by id.
- delete(Long) - Method in class com.example.springrest.services.ProductService
-
Deletes a product by its ID
- Design notes - Search tag in interface com.example.springrest.mappers.ProductMapper
- Section
- Design Notes - Search tag in package com.example.springrest.exceptions
- Section
- Design Notes - Search tag in package com.example.springrest.repositories
- Section
- Design Notes - Search tag in package com.example.springrest.services
- Section
E
- equals(Object) - Method in record class com.example.springrest.dto.ProductRequest
-
Indicates whether some other object is "equal to" this one.
- equals(Object) - Method in record class com.example.springrest.dto.ProductResponse
-
Indicates whether some other object is "equal to" this one.
- Example - Search tag in com.example.springrest.exceptions.GlobalExceptionHandler.handleResourceNotFoundException(ResourceNotFoundException)
- Section
- Example - Search tag in com.example.springrest.exceptions.GlobalExceptionHandler.handleValidationException(MethodArgumentNotValidException)
- Section
- Example - Search tag in package com.example.springrest.controllers
- Section
- Examples - Search tag in interface com.example.springrest.mappers.ProductMapper
- Section
- Examples - Search tag in interface com.example.springrest.repositories.ProductRepo
- Section
- Examples - Search tag in package com.example.springrest.config
- Section
F
- findByNameContainingIgnoreCase(String, Pageable) - Method in interface com.example.springrest.repositories.ProductRepo
-
Finds products whose
name
contains the given keyword, ignoring case sensitivity; paged.
G
- getAll(Pageable) - Method in class com.example.springrest.controllers.ProductController
-
Returns a paginated list of products.
- getById(Long) - Method in class com.example.springrest.controllers.ProductController
-
Reads a product by id.
- getOrThrow(Long) - Method in class com.example.springrest.services.ProductService
-
Retrieves a Product by its ID or throws an exception if not found.
- GlobalExceptionHandler - Class in com.example.springrest.exceptions
-
Global exception handler for REST controllers.
- GlobalExceptionHandler() - Constructor for class com.example.springrest.exceptions.GlobalExceptionHandler
H
- handleResourceNotFoundException(ResourceNotFoundException) - Method in class com.example.springrest.exceptions.GlobalExceptionHandler
-
Handles
ResourceNotFoundException
. - handleValidationException(MethodArgumentNotValidException) - Method in class com.example.springrest.exceptions.GlobalExceptionHandler
-
Handles
MethodArgumentNotValidException
thrown when validation of request bodies fails (e.g.,@Valid
DTOs). - hashCode() - Method in record class com.example.springrest.dto.ProductRequest
-
Returns a hash code value for this object.
- hashCode() - Method in record class com.example.springrest.dto.ProductResponse
-
Returns a hash code value for this object.
I
- id() - Method in record class com.example.springrest.dto.ProductResponse
-
Returns the value of the
id
record component.
L
- list(Pageable) - Method in class com.example.springrest.services.ProductService
-
Returns a paginated/sorted view of all products.
M
- main(String[]) - Static method in class com.example.springrest.SpringRestApplication
N
- name() - Method in record class com.example.springrest.dto.ProductRequest
-
Returns the value of the
name
record component. - name() - Method in record class com.example.springrest.dto.ProductResponse
-
Returns the value of the
name
record component. - Notes - Search tag in package com.example.springrest
- Section
- Notes - Search tag in package com.example.springrest.controllers
- Section
O
- Old way (imperative) - Search tag in com.example.springrest.exceptions.GlobalExceptionHandler.handleResourceNotFoundException(ResourceNotFoundException)
- Section
- Old way (imperative) - Search tag in com.example.springrest.exceptions.GlobalExceptionHandler.handleValidationException(MethodArgumentNotValidException)
- Section
P
- Package layout - Search tag in package com.example.springrest
- Section
- price() - Method in record class com.example.springrest.dto.ProductRequest
-
Returns the value of the
price
record component. - price() - Method in record class com.example.springrest.dto.ProductResponse
-
Returns the value of the
price
record component. - Product - Class in com.example.springrest.models
-
Domain entity representing a product in the catalog.
- Product(String, BigDecimal) - Constructor for class com.example.springrest.models.Product
-
Convenience constructor for creating new products.
- ProductController - Class in com.example.springrest.controllers
-
REST controller for managing products.
- ProductController() - Constructor for class com.example.springrest.controllers.ProductController
- ProductMapper - Interface in com.example.springrest.mappers
-
Maps between API-layer DTOs and the
Product
JPA entity. - ProductRepo - Interface in com.example.springrest.repositories
-
Spring Data repository for
Product
entities. - ProductRequest - Record Class in com.example.springrest.dto
-
Request DTO used to create or update a
Product
. - ProductRequest(String, BigDecimal) - Constructor for record class com.example.springrest.dto.ProductRequest
-
Creates an instance of a
ProductRequest
record class. - ProductResponse - Record Class in com.example.springrest.dto
-
Response DTO returned to clients for
Product
resources. - ProductResponse(Long, String, BigDecimal) - Constructor for record class com.example.springrest.dto.ProductResponse
-
Creates an instance of a
ProductResponse
record class. - ProductService - Class in com.example.springrest.services
-
Application service encapsulating business operations for
Product
s. - ProductService() - Constructor for class com.example.springrest.services.ProductService
R
- ResourceNotFoundException - Exception Class in com.example.springrest.exceptions
-
Exception thrown when a requested resource cannot be found.
- ResourceNotFoundException(String) - Constructor for exception class com.example.springrest.exceptions.ResourceNotFoundException
-
Constructs a new
ResourceNotFoundException
with the specified detail message. - Responsibilities - Search tag in class com.example.springrest.exceptions.GlobalExceptionHandler
- Section
- Responsibilities - Search tag in package com.example.springrest.controllers
- Section
- Responsibilities - Search tag in package com.example.springrest.exceptions
- Section
- Responsibilities - Search tag in package com.example.springrest.services
- Section
S
- search(String, Pageable) - Method in class com.example.springrest.controllers.ProductController
-
Searches products by (case-insensitive) name substring.
- searchByName(String, Pageable) - Method in class com.example.springrest.services.ProductService
-
Searches for products by name (case-insensitive), paged.
- SpringRestApplication - Class in com.example.springrest
- SpringRestApplication() - Constructor for class com.example.springrest.SpringRestApplication
T
- toEntity(ProductRequest) - Method in interface com.example.springrest.mappers.ProductMapper
-
Creates a new
Product
from an incoming request. - toResponse(Product) - Method in interface com.example.springrest.mappers.ProductMapper
-
Creates a
ProductResponse
DTO suitable for API responses. - toString() - Method in record class com.example.springrest.dto.ProductRequest
-
Returns a string representation of this record class.
- toString() - Method in record class com.example.springrest.dto.ProductResponse
-
Returns a string representation of this record class.
- Transactional rules - Search tag in class com.example.springrest.services.ProductService
- Section
- Typical entry point - Search tag in package com.example.springrest
- Section
- Typical responsibilities - Search tag in package com.example.springrest.config
- Section
- Typical usage - Search tag in exception class com.example.springrest.exceptions.ResourceNotFoundException
- Section
U
- update(Long, ProductRequest) - Method in class com.example.springrest.controllers.ProductController
-
Replaces a product’s name and price.
- update(Long, Consumer<Product>) - Method in class com.example.springrest.services.ProductService
-
Applies a mutation function to an existing product and persists the change.
- updateEntity(Product, ProductRequest) - Method in interface com.example.springrest.mappers.ProductMapper
-
Updates an existing
Product
in-place from aProductRequest
. - Usage - Search tag in class com.example.springrest.config.CorsConfig
- Section
- Usage - Search tag in class com.example.springrest.services.ProductService
- Section
All Classes and Interfaces|All Packages|Serialized Form