com.github.sidhant92.boolparser.constant.Operator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bool-parser-java Show documentation
Show all versions of bool-parser-java Show documentation
Java parser for boolean expressions
The newest version!
package com.github.sidhant92.boolparser.constant;
import java.util.Optional;
import com.github.sidhant92.boolparser.operator.AbstractOperator;
import com.github.sidhant92.boolparser.operator.OperatorFactory;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author sidhant.aggarwal
* @since 05/03/2023
*/
@AllArgsConstructor (access = AccessLevel.PRIVATE)
@Getter
public enum Operator {
EQUALS,
GREATER_THAN,
GREATER_THAN_EQUAL,
LESS_THAN,
LESS_THAN_EQUAL,
NOT_EQUAL,
IN,
CONTAINS_ALL,
CONTAINS_ANY;
public static Optional getOperatorFromSymbol(final String symbol) {
final String symbolLowerCase = symbol.toLowerCase();
return OperatorFactory.getAllOperators()
.stream()
.filter(operator -> operator.getSymbol().toLowerCase().equals(symbolLowerCase))
.map(AbstractOperator::getOperator)
.findFirst();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy