Package org.openmuc.jeebus.spine.spi
Class AdditionalSelectorConditions
- java.lang.Object
-
- org.openmuc.jeebus.spine.spi.AdditionalSelectorConditions
-
public class AdditionalSelectorConditions extends java.lang.ObjectRegistry class forAdditionalSelectorCondition. Any new selector types with a condition other thanObjects.equals(java.lang.Object, java.lang.Object)should be added to this class' static initializer.This supersedes the previous mechanism where
AdditionalSelectorConditions needed to be explicitly added by each use case. Reverting to the previous mechanism may prove necessary if a selector type is found which requires different conditions for different use cases. To help detect such a case should it occur,register(Class, Class, AdditionalSelectorCondition)will throw an error if multiple conditions are registered for the same type.Currently registered selector and data types are:
TimestampIntervalTypeselected byTimestampIntervalTypePowerSequencePriceDataTypeselected byPowerSequencePriceListDataSelectorsTypeIncentiveDataTypeselected byIncentiveListDataSelectorsType
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <DATA,SELECTOR>
booleanisSelected(java.lang.Class<DATA> dataClass, java.lang.Class<SELECTOR> selectorClass, DATA data, SELECTOR selector)Retrieve anAdditionalSelectorConditionfrom the registry and check it against the provided selector and data.static <DATA,SELECTOR>
voidregister(java.lang.Class<DATA> dataClass, java.lang.Class<SELECTOR> selectorClass, AdditionalSelectorCondition<DATA,SELECTOR> condition)Register anAdditionalSelectorConditionfor the selector typeAdditionalSelectorConditionsand the data typeAdditionalSelectorConditions.
-
-
-
Method Detail
-
register
public static <DATA,SELECTOR> void register(java.lang.Class<DATA> dataClass, java.lang.Class<SELECTOR> selectorClass, AdditionalSelectorCondition<DATA,SELECTOR> condition)Register anAdditionalSelectorConditionfor the selector typeAdditionalSelectorConditionsand the data typeAdditionalSelectorConditions. Throws an error if there was already a different condition registered for those types.- Type Parameters:
DATA- type of data that the condition checksSELECTOR- type of selector that the condition is for- Parameters:
dataClass- class object forAdditionalSelectorConditionsselectorClass- class object forAdditionalSelectorConditionscondition- The condition to register.
-
isSelected
public static <DATA,SELECTOR> boolean isSelected(java.lang.Class<DATA> dataClass, java.lang.Class<SELECTOR> selectorClass, DATA data, SELECTOR selector)Retrieve anAdditionalSelectorConditionfrom the registry and check it against the provided selector and data.- Type Parameters:
DATA- type of data to selectSELECTOR- type of selector to select with- Parameters:
dataClass- class object forAdditionalSelectorConditionsselectorClass- class object forAdditionalSelectorConditionsdata- data to selectselector- selector to select with- Returns:
- whether the found condition matches, or true if no condition was found.
-
-