This file contains hidden or 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 exercise2_2; | |
| import kotlin.Metadata; | |
| import kotlin.jvm.JvmOverloads; | |
| import kotlin.jvm.internal.DefaultConstructorMarker; | |
| import kotlin.jvm.internal.Intrinsics; | |
| import org.jetbrains.annotations.NotNull; | |
| import org.jetbrains.annotations.Nullable; | |
| @Metadata( |
This file contains hidden or 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 exercise2_2 | |
| data class Product @JvmOverloads constructor( | |
| val name: String, | |
| val price: Double = 0.0, | |
| val desc: String? = null | |
| ) |
This file contains hidden or 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
| fun main(args: Array<String>) { | |
| println("Hello, world!") | |
| val person = Person(first = "Jin", middle = null, last = "West") | |
| if (person.middle != null) { | |
| // 영리한 타입 변환(smart cast) | |
| val middleNameLength = person.middle.length | |
| } | |
| // var 변수 |
This file contains hidden or 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
| plugins { | |
| `java-library` | |
| kotlin("jvm") version "1.5.10" | |
| } | |
| group = "org.example" | |
| version = "1.0-SNAPSHOT" | |
| repositories { | |
| mavenCentral() |
This file contains hidden or 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.time.* | |
| val instant = Instant.now() | |
| val southPole = instant.atZone(ZoneId.of("Antarctica/South_Pole")) | |
| val dst = southPole.zone.rules.isDaylightSavings(instant) | |
| println("It is ${southPole.toLocalTime()} (UTC${southPole.offset}) at the South Pole") | |
| println("The South Pole ${if (dst) "is" else "is not"} on Daylight Savings Time") |
This file contains hidden or 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
| fun main() { | |
| println("Hello, Kotlin") | |
| } |
This file contains hidden or 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
| @Slf4j | |
| public class LoggerInterceptor implements HandlerInterceptor { | |
| @Override | |
| public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | |
| ServletInputStream inputStream = request.getInputStream(); | |
| JsonNode jsonNode = new ObjectMapper().readTree(inputStream); | |
| log.info(jsonNode.toPrettyString()); | |
| return true; | |
| } | |
| } |
This file contains hidden or 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
| @Configuration | |
| public class RequestLoggingFilterConfig { | |
| @Bean | |
| public CommonsRequestLoggingFilter logFilter() { | |
| CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); | |
| filter.setIncludeQueryString(true); | |
| filter.setIncludePayload(true); | |
| filter.setMaxPayloadLength(10000); | |
| filter.setIncludeHeaders(false); | |
| filter.setAfterMessagePrefix("REQUEST DATA : "); |
This file contains hidden or 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
| @Slf4j | |
| public class LoggerInterceptor implements HandlerInterceptor { | |
| @Override | |
| public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | |
| return true; | |
| } | |
| } |
This file contains hidden or 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
| @ToString | |
| @Getter | |
| @Setter | |
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |
| public class Payload { | |
| private int articleId; | |
| } |
NewerOlder