com.github.switcherapi.client.model.SwitcherInterface Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of switcher-client Show documentation
Show all versions of switcher-client Show documentation
Switcher Client SDK for working with Switcher API
package com.github.switcherapi.client.model;
import com.github.switcherapi.client.SwitcherContext;
import com.github.switcherapi.client.exception.SwitcherException;
import com.github.switcherapi.client.model.response.CriteriaResponse;
import java.util.List;
import java.util.Set;
/**
* Defines minimal contract for Switcher implementations for:
*
*
* - Switcher creation
* - Switcher execution
* - Switcher get input/output
*
*/
public interface SwitcherInterface {
/**
* This method builds the Switcher object.
* Uses to isolate Switcher creation from the execution.
*
* For example:
*
* Switcher switcher = SwitcherContext
* .getSwitcher(MY_SWITCHER)
* .remote(true)
* .throttle(1000)
* .checkValue("value")
* .build();
*
*
* @return {@link Switcher}
*/
Switcher build();
/**
* Prepare the Switcher including a list of inputs necessary to run the criteria afterward.
*
* @param entry input object
* @return {@link Switcher}
*/
Switcher prepareEntry(final List entry);
/**
* Prepare the Switcher including a list of inputs necessary to run the criteria afterward.
*
* @param entry input object
* @param add if false, the list will be cleaned and the entry provided will be the only input for this Switcher.
* @return {@link Switcher}
*/
Switcher prepareEntry(final Entry entry, final boolean add);
/**
* It adds an input to the list of inputs.
*
Under the table it calls {@link #prepareEntry(Entry, boolean)} passing true to the second argument.
*
* @param entry input object
* @return {@link Switcher}
*/
Switcher prepareEntry(final Entry entry);
/**
* Execute criteria based on a given switcher key provided via {@link SwitcherContext#getSwitcher(String)}.
*
The detailed result is available in list of {@link CriteriaResponse}.
*
* @return criteria result
* @throws SwitcherException connectivity or criteria errors regarding reading malformed snapshots
*/
boolean isItOn() throws SwitcherException;
/**
* Execute criteria based on a given switcher key provided via {@link SwitcherContext#getSwitcher(String)}.
*
The detailed result is available in list of {@link CriteriaResponse}.
*
* @return {@link CriteriaResponse}
* @throws SwitcherException connectivity or criteria errors regarding reading malformed snapshots
*/
CriteriaResponse submit() throws SwitcherException;
/**
* Execute the criteria evaluation.
*
* @return the criteria response
*/
CriteriaResponse executeCriteria();
/**
* Get the history of executions.
*
* @return the history of executions
*/
Set getHistoryExecution();
/**
* Get the key of the switcher.
*
* @return the key of the switcher
*/
String getSwitcherKey();
/**
* Get the entry input list for the switcher.
*
* @return the entry of the switcher
*/
List getEntry();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy