<dependency>
<groupId>com.github.benmccann</groupId>
<artifactId>postcss-value-parser</artifactId>
<version>2.3.3</version>
</dependency>
import org.w3c.css.sac.LexicalUnit;
public class CustomParser implements LexicalUnit {
private String dimension;
private float floatValue;
public void setNextLexicalUnit(LexicalUnit lexicalUnit) {
this.dimension = lexicalUnit.getDimensionUnitText();
this.floatValue = lexicalUnit.getFloatValue();
}
public String getDimension() {
return dimension;
}
public void setDimension(String dimension) {
this.dimension = dimension;
}
public float getFloatValue() {
return floatValue;
}
publicvoid setFloatValue(float floatValue) {
this.floatValue = floatValue;
}
}
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.github.benmanes.caffeine.cache.RemovalCause;
import com.github.benmanes.caffeine.cache.RemovalListener;
import com.github.benmanes.caffeine.cache.stats.CacheStats;
import com.github.benmanes.caffeine.cache.stats.StatsCounter;
import org.w3c.css.sac.LexicalUnit;
import java.util.concurrent.TimeUnit;
public class CssPropertyValueParser {
private final LoadingCache<String, LexicalUnit> cache;
public CssPropertyValueParser() {
cache = Caffeine.newBuilder()
}
public LexicalUnit parse(String value) {
return cache.get(value);
}
private LexicalUnit parseValue(String value) {
CustomParser parser = new CustomParser();
return parser;
}
public CacheStats getCacheStats() {
return cache.stats();
}
public void clearCache() {
cache.invalidateAll();
}
}