Skip to content

Commit

Permalink
jte and kte works
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuehly committed Jun 1, 2024
1 parent 87554a9 commit 7f10f54
Show file tree
Hide file tree
Showing 79 changed files with 145 additions and 2,088 deletions.
2 changes: 0 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ dependencies {
testFixturesImplementation("org.springframework.boot:spring-boot-starter-web")
testFixturesImplementation("org.springframework.boot:spring-boot-devtools")

implementation("de.tschuehly:spring-view-component-jte-compiler:0.7.5-SNAPSHOT")

}

tasks.withType<KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package de.tschuehly.spring.viewcomponent.core

import de.tschuehly.spring.viewcomponent.core.component.ViewComponentUtils
import org.springframework.context.ApplicationContext

interface IViewContext {
companion object {
var applicationContext: ApplicationContext? = null
var componentTemplate: String? = null
var jteTemplateEngine: Any? = null
var templateSuffx: String = ""

fun <T> server(clazz: Class<T>): T{
Expand All @@ -19,9 +17,15 @@ interface IViewContext {
}

fun getViewComponentTemplateWithoutSuffix(context: IViewContext): String {
val componentName = ViewComponentUtils.getName(context.javaClass)
val componentName = getViewComponentName(context.javaClass)
val componentPackage = context.javaClass.enclosingClass.`package`.name.replace(".", "/") + "/"
return "$componentPackage$componentName"
}
fun getViewComponentName(viewContext: Class<out IViewContext>): String {
val enclosingClass = viewContext.getEnclosingClass()
?: throw ViewContextException("Your ViewContext record/class needs to be defined in the ViewComponent")
return enclosingClass.getSimpleName()
}
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package de.tschuehly.spring.viewcomponent.core

import de.tschuehly.spring.viewcomponent.core.processor.ViewComponentFileSystemWatcher
import de.tschuehly.spring.viewcomponent.core.processor.ViewComponentParser.BuildType
import de.tschuehly.spring.viewcomponent.core.processor.ViewComponentProcessingException
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher
import org.springframework.boot.devtools.classpath.ClassPathRestartStrategy
Expand All @@ -14,7 +11,6 @@ import org.springframework.context.ApplicationEventPublisher
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import java.io.File

@Configuration
@ComponentScan("de.tschuehly.spring.viewcomponent.core")
Expand Down Expand Up @@ -43,4 +39,5 @@ class ViewComponentAutoConfiguration {
return watcher
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package de.tschuehly.spring.viewcomponent.core

class ViewContextException(override val message: String?) : Exception(message) {
class ViewContextException(override val message: String) : Exception(message) {

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.tschuehly.spring.viewcomponent.core.component

import de.tschuehly.spring.viewcomponent.core.IViewContext
import de.tschuehly.spring.viewcomponent.core.exception.ViewComponentException
import org.aspectj.lang.ProceedingJoinPoint
import org.aspectj.lang.annotation.AfterReturning
import org.aspectj.lang.annotation.Around
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Pointcut
Expand All @@ -18,7 +18,7 @@ class ViewComponentAspect(val applicationContext: ApplicationContext) {
//
}

@Around("isViewComponent() && execution(public de.tschuehly.spring.viewcomponent.core.IViewContext+ *(..)) ")
@Around("isViewComponent() && execution(public de.tschuehly.spring.viewcomponent.core.IViewContext+ *(..))")
fun renderInject(joinPoint: ProceedingJoinPoint): IViewContext {
val returnValue = joinPoint.proceed()
val viewContext = if (IViewContext::class.java.isAssignableFrom(returnValue.javaClass)) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7f10f54

Please sign in to comment.