run.halo.app.extension.router.selector.SelectorConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
API of halo project, connecting by other projects.
The newest version!
package run.halo.app.extension.router.selector;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
@Slf4j
public class SelectorConverter implements Converter {
@Override
@Nullable
public SelectorCriteria convert(@Nullable String selector) {
return Arrays.stream(Operator.values())
.sorted(Comparator.comparing(Operator::getOrder))
.map(operator -> {
log.debug("Resolving selector: {} with operator: {}", selector, operator);
return operator.convert(selector);
})
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy