com.innovenso.townplan.dsl.SortKeyContext.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of innovenso-townplanner-dsl Show documentation
Show all versions of innovenso-townplanner-dsl Show documentation
Domain Specific Language for the Innovenso Townplanner
package com.innovenso.townplan.dsl
import lombok.NonNull
class SortKeyContext {
private final Map counterMap = [:]
private String prefix = ""
public String getPrefix() {
return prefix
}
public void setPrefix(String prefixToSet) {
if (prefixToSet) this.prefix = "${prefixToSet}."
else this.prefix = ""
}
String nextSortKey(@NonNull String sortableType) {
Integer currentCount = ++counterMap.getOrDefault(sortableType, 0)
counterMap.put(sortableType, currentCount)
"${prefix}${currentCount}"
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy