All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unlaxer.tinyexpression.OptionalOperator Maven / Gradle / Ivy

The newest version!
package org.unlaxer.tinyexpression;

import java.util.Optional;

import org.unlaxer.Token;

public interface OptionalOperator extends TokenBaseOperator{
  
  public Optional evaluateOptional(C context , Token token);
  
  @Override
  default Object evaluate(C context, Token token) {
    return evaluateOptional(context , token)
      .orElseGet(()->defaultValue(context, token));
  }
  
  public Object defaultValue(C context, Token token);
}