Interface for defining a custom Processor that can modify or validate GrooCSS input.
By extending this interface you can write your own custom validators and add them via Config.
You could also write your own Processor that modifies values in the PRE_VALIDATE phase or any other Phase. For example:
class ConvertAllIntsToPixels implements Processor< Style > {
Optional process(Style style, Phase phase) {
if (phase == Phase.PRE_VALIDATE && style.value instanceof Integer) {
style.value = new Measurement(style.value, 'px')
}
return Optional.empty();
}
}
Modifiers | Name | Description |
---|---|---|
enum |
Processor.Phase |
Enum of phases for which this Processor should be called. |
Type Params | Return Type | Name and description |
---|---|---|
|
Optional<String> |
process(T cssPart, Processor.Phase phase) Returns empty if valid, otherwise returns an optional containing an error string. |
Returns empty if valid, otherwise returns an optional containing an error string.