File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
processor/src/main/kotlin/ru/nsu/kcache
test-web-app/src/main/java/com/example/app/controller Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,18 @@ package ru.nsu.kcache
33import com.google.auto.service.AutoService
44import ru.nsu.kcache.creator.HandlerMetadataContainerCreator
55import ru.nsu.manasyan.kcache.core.annotations.KCacheable
6- import java.nio.file.Path
76import java.nio.file.Paths
87import javax.annotation.processing.*
98import javax.lang.model.SourceVersion
109import javax.lang.model.element.ExecutableElement
1110import javax.lang.model.element.TypeElement
11+ import javax.lang.model.type.DeclaredType
1212import javax.lang.model.type.MirroredTypeException
1313import javax.lang.model.util.Elements
1414import javax.lang.model.util.Types
1515import javax.tools.Diagnostic
1616
17+
1718typealias KCacheableMetadata = MutableMap <String , RequestHandlerMetadata >
1819
1920@AutoService(Processor ::class )
@@ -89,7 +90,10 @@ class KCacheableProcessor : AbstractProcessor() {
8990 separator = " ," ,
9091 postfix = " )"
9192 ) {
92- typeUtils.asElement(it.asType()).toString()
93+ when (val type = it.asType()) {
94+ is DeclaredType -> typeUtils.asElement(type)
95+ else -> type
96+ }.toString()
9397 }
9498
9599 kCacheableMetadata[" $enclosingName .${element.simpleName}$parameters " ] =
Original file line number Diff line number Diff line change 11package com .example .app .controller ;
22
3- import com .example .app .data .TestUser ;
43import com .example .app .service .TestUserService ;
54import org .springframework .http .RequestEntity ;
65import org .springframework .http .ResponseEntity ;
7- import org .springframework .web .bind .annotation .GetMapping ;
8- import org .springframework .web .bind .annotation .PathVariable ;
9- import org .springframework .web .bind .annotation .RequestMapping ;
10- import org .springframework .web .bind .annotation .RestController ;
6+ import org .springframework .web .bind .annotation .*;
117import ru .nsu .manasyan .kcache .core .annotations .KCacheable ;
128
139@ RestController
@@ -25,6 +21,7 @@ public SingleUserController(TestUserService service) {
2521 )
2622 public ResponseEntity <?> getUserById (
2723 @ PathVariable String id ,
24+ @ RequestParam (value = "limit" , defaultValue = "20" ) int limit ,
2825 RequestEntity <?> requestEntity
2926 ) {
3027 return ResponseEntity .ok (service .getUser (id ));
You can’t perform that action at this time.
0 commit comments