当前位置: 首页>>代码示例>>Java>>正文


Java ParameterDescriptor类代码示例

本文整理汇总了Java中org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor的典型用法代码示例。如果您正苦于以下问题:Java ParameterDescriptor类的具体用法?Java ParameterDescriptor怎么用?Java ParameterDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterDescriptor类属于org.graylog.plugins.pipelineprocessor.ast.functions包,在下文中一共展示了ParameterDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SelectJsonPath

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Inject
public SelectJsonPath(ObjectMapper objectMapper) {
    configuration = Configuration.builder()
            .options(Option.SUPPRESS_EXCEPTIONS)
            .jsonProvider(new JacksonJsonNodeJsonProvider(objectMapper))
            .build();

    jsonParam = ParameterDescriptor.type("json", JsonNode.class).description("A parsed JSON tree").build();
    // sigh generics and type erasure
    //noinspection unchecked
    pathsParam = ParameterDescriptor.type("paths",
                                          (Class<Map<String, String>>) new TypeLiteral<Map<String, String>>() {}.getRawType(),
                                          (Class<Map<String, JsonPath>>) new TypeLiteral<Map<String, JsonPath>>() {}.getRawType())
            .transform(inputMap -> inputMap
                    .entrySet().stream()
                    .collect(toMap(Map.Entry::getKey, e -> JsonPath.compile(e.getValue()))))
            .description("A map of names to a JsonPath expression, see http://jsonpath.com")
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:20,代码来源:SelectJsonPath.java

示例2: exitFunctionCall

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Override
public void exitFunctionCall(RuleLangParser.FunctionCallContext ctx) {
    final FunctionExpression expr = (FunctionExpression) parseContext.expressions().get(ctx);
    final FunctionDescriptor<?> descriptor = expr.getFunction().descriptor();
    final FunctionArgs args = expr.getArgs();
    for (ParameterDescriptor p : descriptor.params()) {
        final Expression argExpr = args.expression(p.name());
        if (argExpr != null && !p.type().isAssignableFrom(argExpr.getType())) {
            parseContext.addError(new IncompatibleArgumentType(ctx, expr, p, argExpr));
        }
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:13,代码来源:PipelineRuleParser.java

示例3: IncompatibleArgumentType

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
public IncompatibleArgumentType(RuleLangParser.FunctionCallContext ctx,
                                FunctionExpression functionExpression,
                                ParameterDescriptor p,
                                Expression argExpr) {
    super("incompatible_argument_type", ctx);
    this.functionExpression = functionExpression;
    this.p = p;
    this.argExpr = argExpr;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:10,代码来源:IncompatibleArgumentType.java

示例4: MissingRequiredParam

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
public MissingRequiredParam(RuleLangParser.FunctionCallContext ctx,
                            Function<?> function,
                            ParameterDescriptor param) {
    super("missing_required_param", ctx);
    this.function = function;
    this.param = param;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:8,代码来源:MissingRequiredParam.java

示例5: toString

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@JsonProperty("reason")
@Override
public String toString() {
    final Predicate<ParameterDescriptor> optional = ParameterDescriptor::optional;
    return "Expected " + function.descriptor().params().stream().filter(optional.negate()).count() +
            " arguments but found " + argCount +
            " in call to function " + function.descriptor().name()
            + positionString();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:10,代码来源:WrongNumberOfArgs.java

示例6: toString

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@JsonProperty("reason")
@Override
public String toString() {
    int paramPosition = 1;
    for (ParameterDescriptor descriptor : function.descriptor().params()) {
        if (descriptor.name().equals(failure.getArgumentName())) {
            break;
        }
        paramPosition++;
    }

    return "Unable to pre-compute value for " + ordinal(paramPosition) + " argument " + failure.getArgumentName() + " in call to function " + function.descriptor().name() + ": " + failure.getCause().getMessage();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:14,代码来源:InvalidFunctionArgument.java

示例7: CidrMatch

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
public CidrMatch() {
    // a little ugly because newCIDR throws a checked exception :(
    cidrParam = ParameterDescriptor.string("cidr", CIDR.class).transform(cidrString -> {
        try {
            return CIDR.newCIDR(cidrString);
        } catch (UnknownHostException e) {
            throw new IllegalArgumentException(e);
        }
    }).description("The CIDR subnet mask").build();
    ipParam = ParameterDescriptor.type(IP, IpAddress.class).description("The parsed IP address to match against the CIDR mask").build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:12,代码来源:CidrMatch.java

示例8: params

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Override
protected ImmutableList<ParameterDescriptor> params() {
    return ImmutableList.of(
            valueParam,
            defaultParam
    );
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:8,代码来源:FlexParseDate.java

示例9: params

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Override
protected ImmutableList<ParameterDescriptor> params() {
    return ImmutableList.of(
            valueParam,
            patternParam,
            localeParam
    );
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:9,代码来源:ParseDate.java

示例10: TimezoneAwareFunction

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
protected TimezoneAwareFunction() {
    timeZoneParam = ParameterDescriptor
            .string(TIMEZONE, DateTimeZone.class)
            .transform(id -> DateTimeZone.forID(UPPER_ZONE_MAP.getOrDefault(id.toUpperCase(Locale.ENGLISH), "UTC")))
            .optional()
            .description("The timezone to apply to the date, defaults to UTC")
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:9,代码来源:TimezoneAwareFunction.java

示例11: descriptor

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Override
public FunctionDescriptor<DateTime> descriptor() {
    return FunctionDescriptor.<DateTime>builder()
            .name(getName())
            .returnType(DateTime.class)
            .params(ImmutableList.<ParameterDescriptor>builder()
                            .addAll(params())
                            .add(timeZoneParam)
                            .build())
            .description(description())
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:13,代码来源:TimezoneAwareFunction.java

示例12: FormatDate

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
public FormatDate() {
    value = ParameterDescriptor.type("value", DateTime.class).description("The date to format").build();
    format = ParameterDescriptor.string("format", DateTimeFormatter.class)
            .transform(DateTimeFormat::forPattern)
            .description("The format string to use, see http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html")
            .build();
    timeZoneParam = ParameterDescriptor.string("timezone", DateTimeZone.class)
            .transform(DateTimeZone::forID)
            .optional()
            .description("The timezone to apply to the date, defaults to UTC")
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:13,代码来源:FormatDate.java

示例13: GrokMatch

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Inject
public GrokMatch(GrokPatternRegistry grokPatternRegistry) {
    this.grokPatternRegistry = grokPatternRegistry;

    valueParam = ParameterDescriptor.string("value").description("The string to apply the Grok pattern against").build();
    patternParam = ParameterDescriptor.string("pattern").description("The Grok pattern").build();
    namedOnly = ParameterDescriptor.bool("only_named_captures").optional().description("Whether to only use explicitly named groups in the patterns").build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:9,代码来源:GrokMatch.java

示例14: StringUtilsFunction

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
public StringUtilsFunction() {
    valueParam = ParameterDescriptor.string(VALUE).description("The input string").build();
    localeParam = ParameterDescriptor.string(LOCALE, Locale.class)
            .optional()
            .transform(Locale::forLanguageTag)
            .description("The locale to use, defaults to English")
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:9,代码来源:StringUtilsFunction.java

示例15: descriptor

import org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor; //导入依赖的package包/类
@Override
public FunctionDescriptor<String> descriptor() {
    ImmutableList.Builder<ParameterDescriptor> params = ImmutableList.builder();
    params.add(valueParam);
    if (isLocaleAware()) {
        params.add(localeParam);
    }
    return FunctionDescriptor.<String>builder()
            .name(getName())
            .returnType(String.class)
            .params(params.build())
            .description(description())
            .build();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:15,代码来源:StringUtilsFunction.java


注:本文中的org.graylog.plugins.pipelineprocessor.ast.functions.ParameterDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。