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

org.elasticsearch.xpack.esql.expression.function.FunctionDefinition Maven / Gradle / Ivy

There is a newer version: 8.16.1
Show newest version
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */
package org.elasticsearch.xpack.esql.expression.function;

import org.elasticsearch.xpack.esql.core.expression.function.Function;
import org.elasticsearch.xpack.esql.core.session.Configuration;

import java.util.List;

import static org.elasticsearch.common.logging.LoggerMessageFormat.format;

public class FunctionDefinition {
    /**
     * Converts an {@link UnresolvedFunction} into a proper {@link Function}.
     * 

* Provides the basic signature (unresolved function + runtime configuration object) while * allowing extensions through the vararg extras which subclasses should expand for their * own purposes. */ @FunctionalInterface public interface Builder { Function build(UnresolvedFunction uf, Configuration configuration, Object... extras); } private final String name; private final List aliases; private final Class clazz; private final Builder builder; public FunctionDefinition(String name, List aliases, Class clazz, Builder builder) { this.name = name; this.aliases = aliases; this.clazz = clazz; this.builder = builder; } public String name() { return name; } public List aliases() { return aliases; } public Class clazz() { return clazz; } public Builder builder() { return builder; } @Override public String toString() { return format(null, "{}({})", name, aliases.isEmpty() ? "" : aliases.size() == 1 ? aliases.get(0) : aliases); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy