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
| // 프로그램의 대부분은 아래와 같이 순수한 함수들의 연결로 표현합니다. | |
| const join = (a: string, b: string) => a + ", " + b | |
| // print는 문자열을 받아 함수를 반환하므로 순수한 함수입니다. | |
| const print = (message: string) => { | |
| return () => { console.log(message) } | |
| } | |
| // 함수 합성 | |
| const program = print(join("hello", "world!")) |
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
| public static void validateProxyability(PersistentClass persistentClass) { | |
| Iterator properties = persistentClass.getPropertyIterator(); | |
| Class clazz = persistentClass.getMappedClass(); | |
| while(properties.hasNext()) { | |
| Property property = (Property)properties.next(); | |
| validateGetterSetterMethodProxyability("Getter", property.getGetter(clazz).getMethod()); | |
| validateGetterSetterMethodProxyability("Setter", property.getSetter(clazz).getMethod()); | |
| } |
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 javax.persistence.* | |
| @Entity | |
| @Table(name = "member") | |
| class Member( | |
| @Id | |
| @Column(name = "member_id") | |
| var id: String, | |
| var username: String, |
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
| sourceSets { | |
| main { | |
| output.setResourcesDir(kotlin.classesDirectory) | |
| } | |
| } |
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 { | |
| kotlin("plugin.noarg") version "<Kotlin-version>" | |
| } | |
| // kotlin-jpa 플러그인을 사용할 경우 필요 없음 | |
| allOpen { | |
| annotation("javax.persistence.Entity") | |
| annotation("javax.persistence.Embeddable") | |
| annotation("javax.persistence.MappedSuperclass") | |
| } |
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 { | |
| id("org.jetbrains.kotlin.plugin.allopen") version "<Kotlin-version>" | |
| } | |
| allOpen { | |
| annotation("javax.persistence.Entity") | |
| annotation("javax.persistence.Embeddable") | |
| annotation("javax.persistence.MappedSuperclass") | |
| } |
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
| service Echo { | |
| rpc OneToOne(Message) returns (Message) {} | |
| rpc OneToMany(Message) returns (stream Message) {} | |
| rpc ManyToOne(stream Message) returns (Message) {} | |
| rpc ManyToMany(stream Message) returns (stream Message) {} | |
| } | |
| message Message { | |
| int32 seq = 1; | |
| string title = 2; |
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
| @Get("/test") | |
| public HttpResponse getTest(RequestContext ctx) { | |
| CompletableFuture<HttpResponse> future = new CompletableFuture<>(); | |
| WebClient client = WebClient.of("https://icanhazdadjoke.com"); | |
| HttpResponse response = client.execute(RequestHeaders.of(HttpMethod.GET, "/", HttpHeaderNames.ACCEPT, HttpHeaderValues.APPLICATION_JSON)); | |
| ContextAwareEventLoop eventLoop = ctx.eventLoop(); | |
| response.aggregate().thenAcceptAsync(aggregatedRes -> { | |
| AggregatedHttpResponse res = ... // do something with `aggregatedRes` | |
| future.complete(res.toHttpResponse()); | |
| }, eventLoop); |
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
| default <T> CompletionStage<T> makeContextAware(CompletionStage<T> stage) { // A 인스턴스를 인자로 받음 | |
| // 생략 | |
| final CompletableFuture<T> future = JavaVersionSpecific.get().newContextAwareFuture(this); // B 인스턴스 생성 | |
| stage.handle((result, cause) -> { // A와 B를 간접적으로 연결 | |
| try (SafeCloseable ignored = push()) { | |
| if (cause != null) { | |
| future.completeExceptionally(cause); | |
| } else { | |
| future.complete(result); | |
| } |
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
| @Get("/test") | |
| public HttpResponse getTest(RequestContext ctx) { | |
| CompletableFuture<HttpResponse> future = new CompletableFuture<>(); | |
| WebClient client = WebClient.of("https://icanhazdadjoke.com"); | |
| HttpResponse response = client.execute(RequestHeaders.of(HttpMethod.GET, "/", HttpHeaderNames.ACCEPT, HttpHeaderValues.APPLICATION_JSON)); | |
| response.aggregate().thenAccept(aggregatedRes -> { | |
| try (SafeCloseable ignored = ctx.push()) { | |
| AggregatedHttpResponse res = ... // do something with `aggregatedRes` | |
| future.complete(res.toHttpResponse()); | |
| } |
NewerOlder