org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor Maven / Gradle / Ivy
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* .
*/
package org.graylog.plugins.pipelineprocessor.ast.functions;
import com.google.auto.value.AutoValue;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.graylog.plugins.pipelineprocessor.EvaluationContext;
import org.graylog.plugins.pipelineprocessor.ast.expressions.Expression;
import java.util.Optional;
import javax.annotation.Nullable;
@AutoValue
@JsonAutoDetect
public abstract class ParameterDescriptor {
@JsonProperty
public abstract Class type();
@JsonProperty
public abstract Class transformedType();
@JsonProperty
public abstract String name();
@JsonProperty
public abstract boolean optional();
@JsonIgnore
public abstract java.util.function.Function transform();
@JsonProperty
@Nullable
public abstract String description();
public static Builder param() {
return new AutoValue_ParameterDescriptor.Builder().optional(false);
}
public static Builder string(String name) {
return string(name, String.class);
}
public static Builder string(String name, Class transformedClass) {
return ParameterDescriptor.param().type(String.class).transformedType(transformedClass).name(name);
}
public static Builder