Package de.bmiag.tapir.variant.service
Class FeatureBasedContainer<T>
- java.lang.Object
-
- de.bmiag.tapir.variant.service.FeatureBasedContainer<T>
-
- All Implemented Interfaces:
FeatureBased
public final class FeatureBasedContainer<T> extends java.lang.Object implements FeatureBased
This is a container which holds a single non-null element and an optionalFeatureExpression
.- Since:
- 3.3.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<FeatureExpression>
getActivateByFeatureExpression()
Returns the condition which has to match for this instance to be providedstatic <V> FeatureBasedContainer<V>
of(V element)
Creates a newFeatureBasedContainer
with the given element and without expression.static <V> FeatureBasedContainer<V>
of(V element, FeatureExpression expression)
Creates a newFeatureBasedContainer
with the given element and expression.
-
-
-
Method Detail
-
of
public static <V> FeatureBasedContainer<V> of(V element)
Creates a newFeatureBasedContainer
with the given element and without expression.- Parameters:
element
- The element which is stored in the new container. Must not benull
.- Returns:
- A new container.
- Throws:
java.lang.NullPointerException
- If the given element isnull
.- Since:
- 3.3.0
-
of
public static <V> FeatureBasedContainer<V> of(V element, FeatureExpression expression)
Creates a newFeatureBasedContainer
with the given element and expression.- Parameters:
element
- The element which is stored in the new container. Must not benull
.expression
- The feature expression to control whether this element is used or not. Must not benull
.- Returns:
- A new container.
- Throws:
java.lang.NullPointerException
- If the given element or the given feature expression isnull
.- Since:
- 3.3.0
-
getActivateByFeatureExpression
@Pure public java.util.Optional<FeatureExpression> getActivateByFeatureExpression()
Description copied from interface:FeatureBased
Returns the condition which has to match for this instance to be provided- Specified by:
getActivateByFeatureExpression
in interfaceFeatureBased
- Returns:
- an instance of
FeatureExpression
. An emptyOptional
is handled like an expression which evaluates to true.
-
-