Hi @brepine ,
now you can only add functions via the ExpressionManager
interface. If you want to keep using your custom function mappers, you could subclass the existing ExpressionManager, e. g. write a subclass of the JuelExpressionManager which only overwrites the createFunctionMapperFunction
which then enables you to respect additional function mappers.
I could think of something like the following. Warning: I have not tested this code.
public class CustomJuelExpressionManager extends JuelExpressionManager {
private Collection<FunctionMapper> additionalFunctionMappers = new LinkedList<>();
public void addFunctionMapper(FunctionMapper functionMapper) {
additionalFunctionMappers.add(functionMapper);
}
@Override
protected FunctionMapper createFunctionMapper() {
FunctionMapper baseMapper = super.createFunctionMapper();
return new FunctionMapper() {
@Override
public Method resolveFunction(String prefix, String localName) {
return Optional.ofNullable(baseMapper.resolveFunction(prefix, localName))
.or(() -> additionalFunctionMappers.stream().flatMap(mapper -> Optional.ofNullable(mapper.resolveFunction(prefix, localName)).stream()).findFirst())
.orElse(null);
}
};
}
}
Otherwise, you would need to rewrite your function mappers and register every function itself which might be easier for you.
I hope this helps,
Adagatiya