Skip to content

Instantly share code, notes, and snippets.

@jinhyeong
jinhyeong / Product.java
Created March 31, 2022 13:09
decompile
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(
@jinhyeong
jinhyeong / Product.kt
Created March 31, 2022 13:08
data class Product @jvmoverloads constructor
package exercise2_2
data class Product @JvmOverloads constructor(
val name: String,
val price: Double = 0.0,
val desc: String? = null
)
@jinhyeong
jinhyeong / example2-1.kt
Created February 23, 2022 15:05
example2-1.kt
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 변수
@jinhyeong
jinhyeong / build.gradle.kts
Created February 23, 2022 14:19
build.gradle.kts
plugins {
`java-library`
kotlin("jvm") version "1.5.10"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
@jinhyeong
jinhyeong / southpole.kts
Created February 23, 2022 12:58
southpole.kts
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")
@jinhyeong
jinhyeong / hello.kt
Created February 23, 2022 12:34
hello.kt
fun main() {
println("Hello, Kotlin")
}
@jinhyeong
jinhyeong / LoggerInterceptor.java
Created January 11, 2022 13:12
LoggerInterceptor
@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;
}
}
@jinhyeong
jinhyeong / RequestLoggingFilterConfig.java
Created January 11, 2022 13:05
RequestLoggingFilterConfig
@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 : ");
@jinhyeong
jinhyeong / LoggerInterceptor.java
Created January 11, 2022 12:24
LoggerInterceptor
@Slf4j
public class LoggerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return true;
}
}
@ToString
@Getter
@Setter
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class Payload {
private int articleId;
}