com.ybo.trackingplugin.tasks.utils.impl.patterns.JavaMethodPattern.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of traceplugin Show documentation
Show all versions of traceplugin Show documentation
gradle plugin allowing to add automatic logs (or other process) at the start of each traced method
package com.ybo.trackingplugin.tasks.utils.impl.patterns
import com.ybo.trackingplugin.tasks.data.PatternToSearch
import com.ybo.trackingplugin.tasks.data.TraceAnnotationMark
internal class JavaMethodPattern(
val markToLookFor: TraceAnnotationMark,
) : PatternToSearch {
private val toProcessAnnotationShort: String = markToLookFor.shortVersion
private val toProcessAnnotationLong: String = markToLookFor.longVersion
override val name = JavaMethodPatternName.JavaNormalMethod
override fun regex(): Regex {
return Regex("($toProcessAnnotationShort|$toProcessAnnotationLong)\\s*\\n*(?:\\s*@[^\\n]*\\s*\\n*)*\\s*(?:public\\s+|protected\\s+|private\\s+|static\\s+|\\s)[\\w<>\\[\\]\\.]+\\s+(\\w+)\\s*\\(([^)]*)\\)\\s*\\{[ \\t]*\\n*([ \\t]*)")
}
}