Getting Started
Add the dependency
- Maven
- Gradle (Kotlin)
pom.xml
<dependency>
<groupId>dev.cookiecode</groupId>
<artifactId>stylesniffer</artifactId>
<version>1.0.0</version>
</dependency>
gradle.properties
implementation("dev.cookiecode:stylesniffer-impl:1.0.0")
Use StyleSniffer in your code
- Java
- Kotlin
// Create an instance of StyleSniffer
var styleSniffer = StyleSnifferFactory.createStyleSniffer();
// Retrieve a CaseStyle and handle the result
Optional<CaseStyle> caseStyle = styleSniffer.getCaseStyle("myVariableName");
caseStyle.ifPresent(style -> System.out.println("Matched style: " + style.getName()));
// Retrieve and print supported case styles
Set<String> supportedStyles = styleSniffer.getSupportedCaseStyles();
System.out.println("Supported styles: " + supportedStyles);
gradle.properties
// Create an instance of StyleSniffer
val styleSniffer = StyleSnifferFactory.createStyleSniffer()
// Retrieve a CaseStyle and handle the result
val caseStyle: CaseStyle? = styleSniffer.getCaseStyle("myVariableName")
caseStyle?.let {
println("Matched style: ${it.getName()}")
}
// Retrieve and print supported case styles
val supportedStyles: Set<String> = styleSniffer.getSupportedCaseStyles()
println("Supported styles: $supportedStyles")