Skip to content

Commit

Permalink
feature: ViewComponentUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuehly committed Sep 15, 2023
1 parent 8268aa2 commit 7d7080b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ViewActionConfiguration(
method
)
} else {
PathMapping(viewActionPair.second.lowercase(), viewActionPair.first, method)
PathMapping(viewActionPair.second, viewActionPair.first, method)

}
createRequestMappingForAnnotation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ViewActionRegistry {
if (viewActionMapping.containsKey(key)) {
throw ViewActionRegistryException("Cannot register duplicate path mapping")
}
logger.info("Registered endpoint ${mapping.path} to $viewComponentName::${mapping.method.name}")
logger.info("Registered endpoint ${mapping.requestMethod}: ${mapping.path} to $viewComponentName::${mapping.method.name}")
viewActionMapping[key] = mapping
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package de.tschuehly.spring.viewcomponent.core.component

import de.tschuehly.spring.viewcomponent.core.IViewContext
import java.util.*

object ViewComponentUtils {
@JvmStatic
fun getId(viewContext: Class<out IViewContext>): String {
return viewContext.getEnclosingClass().getSimpleName().lowercase(Locale.getDefault())
}

@JvmStatic
fun getTarget(viewContext: Class<out IViewContext?>): String {
return "#${viewContext.getEnclosingClass().getSimpleName().lowercase()}"
}
}

0 comments on commit 7d7080b

Please sign in to comment.