This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Product { | |
private String title; | |
private String description; | |
private double price; | |
private double discountPercentage; | |
private double rating; | |
private int stock; | |
private String brand; | |
private String category; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OAuthService { | |
public void signIn(String medium, String userName, String password) { | |
if (medium.equals("google")) { | |
System.out.println("Sign in with your Google account!"); | |
} | |
if (medium.equals("facebook")) { | |
System.out.println("Sign in with your Facebook account!"); | |
} | |
if (medium.equals("github")) { | |
System.out.println("Sign in with your Github account!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class UserService { | |
public List<String> cart = new ArrayList<>(); | |
public void registerNewUser(String mailID) { | |
System.out.println("Register a new user ....."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.function.Consumer; | |
public class StreamForEach { | |
public static void main(String[] args) { | |
List<Product> productList = ProductList.getProductList(); | |
// get all product details | |
productList.stream().forEach(System.out::println); | |
System.out.println("--------------------------------------------------------------------"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports are removed | |
public class ProductList { | |
public static List<Product> getProductList() { | |
List<Product> products = new ArrayList<>(); | |
products.add(new Product("iPhone 9", "An apple mobile", 549, 12.96, 4.69, 94, "Apple", "smartphones")); | |
products.add(new Product("iPhone X", "An apple mobile", 899, 17.94, 4.44, 34, "Apple", "smartphones")); | |
products.add(new Product("Samsung Universe 9", "Samsung's new variant", 1249, 15.46, 4.09, 36, "Samsung", "smartphones")); | |
products.add(new Product("MacBook Pro", "MacBook Pro 2021 with mini-LED display", 1749, 11.02, 4.57, 83, "Samsung", "laptops")); | |
products.add(new Product("perfume Oil", "Mega Discount", 13, 8.4, 4.26, 65, "Impression of Acqua Di Gio", "fragrances")); | |
products.add(new Product("Pubg Printed Graphic T-Shirt", "Vibrant & colorful printing on front", 46, 16.44, 4.62, 136, "The Warehouse", "mens-shirts")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raven.jdbctemplate.controller; | |
import com.raven.jdbctemplate.model.CustomerModel; | |
import com.raven.jdbctemplate.repository.CustomerJDBCRepository; | |
import io.swagger.v3.oas.annotations.Operation; | |
import io.swagger.v3.oas.annotations.media.ArraySchema; | |
import io.swagger.v3.oas.annotations.media.Content; | |
import io.swagger.v3.oas.annotations.media.ExampleObject; | |
import io.swagger.v3.oas.annotations.media.Schema; | |
import io.swagger.v3.oas.annotations.parameters.RequestBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raven.jdbctemplate.repository; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.util.List; | |
import java.util.Optional; | |
import com.raven.jdbctemplate.model.CustomerModel; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.jdbc.core.JdbcTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raven.jdbctemplate.repository; | |
import java.util.List; | |
import java.util.Optional; | |
import com.raven.jdbctemplate.model.CustomerModel; | |
public interface CustomerRepository { | |
// gets the total record count | |
int count(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raven.jdbctemplate.model; | |
public class CustomerModel { | |
private int customerNumber = 0; | |
private String customerName = ""; | |
private String phone = ""; | |
private String address1 = ""; | |
private String city = ""; | |
private String country = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raven.jdbctemplate.config; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.boot.jdbc.DataSourceBuilder; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.jdbc.core.JdbcTemplate; | |
import javax.sql.DataSource; |
NewerOlder