com.memority.toolkit.rule.api.SelectRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolkit-rule-api Show documentation
Show all versions of toolkit-rule-api Show documentation
This artifact provides the API classes that are necessary to implement the contracts of Memority configuration Rules.
/*
* Copyright (c) 2016-2023 Memority. All Rights Reserved.
*
* This file is part of Memority Toolkit API , a Memority project.
*
* This file is released under the Memority Public Artifacts End-User License Agreement,
* see
* Unauthorized copying of this file, via any medium is strictly prohibited.
*/
package com.memority.toolkit.rule.api;
import com.memority.toolkit.rule.api.context.Context;
import java.util.List;
/**
* This Rule is used to select a choice amongst several. It returns one of the given choices String value.
*
* The available choices values are available as a method argument and at the {@link #KEY_CHOICES} key in the
* passed context.
*
* @see Context
*/
public interface SelectRule extends Rule {
/**
* The input value is exposed through this key as {@value #KEY_CHOICES}
*/
String KEY_CHOICES = "CHOICES";
@Override
default RuleType getRuleType() {
return RuleType.SELECT;
}
/**
* Run the Select Rule to select amongst the given choices
and with the given context
,
* and return the selected choice.
*
* @param choices the list of possible choices, never null
* @param context the execution context
* @return the selected choice, never null
*/
String select(List choices, final Context context);
}