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 edu.knoldus.enumeration; | |
enum Rose { | |
RED(true), BLACK(false), WHITE(true), PINK(true), BROWN(false); | |
private final boolean isAvailable; | |
int count = 0; | |
Rose(boolean isAvailable) { | |
System.out.println("Instance " + (++count) + " for constant " + this.name() + " created."); |
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 edu.knoldus.enumeration; | |
enum BoardMaterial {WHITE, BLACK, SHEET} | |
enum BoardMaterial2 {BLACK} | |
public class BasicEnumerationDemo { | |
public static void main(String[] args) { | |
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 edu.knoldus.enumeration; | |
enum BoardMaterial {WHITE, BLACK, SHEET} | |
public class BasicEnumerationConcept { | |
public static void main(String[] args) { | |
// create an instance of BoardMaterial enum and assign a value to it. | |
BoardMaterial material = BoardMaterial.BLACK; | |
System.out.println(material); |
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 edu.knoldus.com.handsonspringboot.zipwithblogcontent.controller; | |
import edu.knoldus.com.handsonspringboot.zipwithblogcontent.repository.BlogRepository; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import reactor.core.publisher.Mono; |
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
Service A implementation.... | |
private static final ParameterizedTypeReference< | |
ResponseEntity<ThirdPartyResponse>> ROUTE = | |
new ParameterizedTypeReference<ResponseEntity<ThirdPartyResponse>>() { | |
}; | |
private WebClient webClient; | |
//Method in service A used to invoke the service B using the webclient from spring-boot webflux. |
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
Service A implementation.... | |
private static final ParameterizedTypeReference< | |
ResponseEntity<ThirdPartyResponse>> ROUTE = | |
new ParameterizedTypeReference<ResponseEntity<ThirdPartyResponse>>() { | |
}; | |
private WebClient webClient; | |
//Method in service A used to invoke the service B using the webclient from spring-boot webflux. |
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
/* Let suppose we need to create a class called MySummation, that provides a sum of marks obtained by a student in his annual | |
examination. Now marks in a subject can be int, float or double. So we need to have a method that can take these types as | |
parameters and perform the computation accordingly. */ | |
class MySum<T> { | |
T sum; // sum is now of type T which is a parameterized type. | |
MySum(T totalMarks){ | |
sum = totalMarks; // Assign sum the value in totalMarks can be a int, double, float etc. | |
} |
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
/* Let suppose we need to create a class called MySummation, that provides a sum of marks obtained by a student in his annual | |
examination. Now marks in a subject can be int, float or double. So we need to have a method that can take these types as | |
parameters and perform the computation accordingly. */ | |
class MySum { | |
Object sum; // sum is now of type object | |
MySum(Object totalMarks){ | |
sum = totalMarks; // Assign sum the value in totalMarks can be a int, double, float etc. | |
} |
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
@Singleton | |
public class ErrorHandler extends DefaultHttpErrorHandler { | |
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); | |
@Inject | |
public ErrorHandler(Config configuration, Environment environment, | |
OptionalSourceMapper sourceMapper, Provider<Router> routes) { | |
super(configuration, environment, sourceMapper, routes); | |
} |
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
@Singleton | |
public class ErrorHandler extends DefaultHttpErrorHandler { | |
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); | |
@Inject | |
public ErrorHandler(Configuration configuration, Environment environment, | |
OptionalSourceMapper sourceMapper, Provider<Router> routes) { | |
super(configuration, environment, sourceMapper, routes); | |
} |