Interface PropertyConditional<C extends PropertyConditional<C>>
-
- All Superinterfaces:
Conditional<C>,Copyable<C>
- All Known Implementing Classes:
DefaultPropertyConditional
public interface PropertyConditional<C extends PropertyConditional<C>> extends Conditional<C>
An extension ofConditionalthat is used for checking if a property matches a certain criteria or value. This conditional is useful in scenarios where a property's state is relevant to gate certain functionality.For example, a conditional that is match when the property "type" has a value of "PRODUCT":
Conditionals.when("type").equalTo("PRODUCT")- Author:
- Nick Crum (ncrum)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPropertyConditional.DefaultOperatorsThe default set of common supported operators.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Ccontains(Object value)Condition is true when thefield(java.lang.String)contains thevalue(java.lang.Object).default CcontainsIgnoreCase(Object value)Condition is true when thefield(java.lang.String)contains thevalue(java.lang.Object)ignoring case.default CequalTo(Object value)Condition is true when thefield(java.lang.String)is equal tovalue(java.lang.Object).default Cexists()Condition is true when thefield(java.lang.String)exists.default Cfield(String field)Define the field targeted by this conditional.StringgetField()StringgetOperator()default StringgetType()The type of conditional.ObjectgetValue()default CgreaterThan(Object value)Condition is true when thefield(java.lang.String)is greater thanvalue(java.lang.Object).default CgreaterThanOrEqualTo(Object value)Condition is true when thefield(java.lang.String)is greater than or equal tovalue(java.lang.Object).default ClessThan(Object value)Condition is true when thefield(java.lang.String)is less thanvalue(java.lang.Object).default ClessThanOrEqualTo(Object value)Condition is true when thefield(java.lang.String)is less than or equal tovalue(java.lang.Object).default Cnone()Alias fornotExists().default CnotBlank()Condition is true when thefield(java.lang.String)value is not blank.default CnotContains(Object value)Condition is true when thefield(java.lang.String)does not contain thevalue(java.lang.Object).default CnotContainsIgnoreCase(Object value)Condition is true when thefield(java.lang.String)does not contain thevalue(java.lang.Object)ignoring case.default CnotEqualTo(Object value)Condition is true when thefield(java.lang.String)is not equal tovalue(java.lang.Object).default CnotExists()Condition is true when thefield(java.lang.String)does not exist.default Coperator(String operator)Define the operator for this conditional.voidsetField(String field)voidsetOperator(String operator)voidsetValue(Object value)default Cvalue(Object value)Define the value for this conditional.-
Methods inherited from interface com.broadleafcommerce.metadata.dsl.core.Conditional
self
-
-
-
-
Field Detail
-
TYPE
static final String TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
default String getType()
Description copied from interface:ConditionalThe type of conditional. This is used to distinguish different types of conditionals.- Specified by:
getTypein interfaceConditional<C extends PropertyConditional<C>>- Returns:
- the type
-
getField
String getField()
-
getOperator
String getOperator()
-
getValue
@Nullable Object getValue()
-
setField
void setField(String field)
-
setOperator
void setOperator(String operator)
-
setValue
void setValue(@Nullable Object value)
-
field
default C field(String field)
Define the field targeted by this conditional.- Parameters:
field- the field name- Returns:
- this
-
operator
default C operator(String operator)
Define the operator for this conditional. Typically one ofPropertyConditional.DefaultOperators.- Parameters:
operator- the operator- Returns:
- this
-
value
default C value(@Nullable Object value)
Define the value for this conditional.- Parameters:
value- the value- Returns:
- this
-
exists
default C exists()
Condition is true when thefield(java.lang.String)exists.- Returns:
- the conditional
-
notBlank
default C notBlank()
Condition is true when thefield(java.lang.String)value is not blank.- Returns:
- the conditional
-
notExists
default C notExists()
Condition is true when thefield(java.lang.String)does not exist.- Returns:
- the conditional
-
none
default C none()
Alias fornotExists().- Returns:
- the conditional
-
equalTo
default C equalTo(Object value)
Condition is true when thefield(java.lang.String)is equal tovalue(java.lang.Object).- Returns:
- the conditional
-
notEqualTo
default C notEqualTo(Object value)
Condition is true when thefield(java.lang.String)is not equal tovalue(java.lang.Object).- Returns:
- the conditional
-
greaterThan
default C greaterThan(Object value)
Condition is true when thefield(java.lang.String)is greater thanvalue(java.lang.Object).- Returns:
- the conditional
-
greaterThanOrEqualTo
default C greaterThanOrEqualTo(Object value)
Condition is true when thefield(java.lang.String)is greater than or equal tovalue(java.lang.Object).- Returns:
- the conditional
-
lessThan
default C lessThan(Object value)
Condition is true when thefield(java.lang.String)is less thanvalue(java.lang.Object).- Returns:
- the conditional
-
lessThanOrEqualTo
default C lessThanOrEqualTo(Object value)
Condition is true when thefield(java.lang.String)is less than or equal tovalue(java.lang.Object).- Returns:
- the conditional
-
contains
default C contains(Object value)
Condition is true when thefield(java.lang.String)contains thevalue(java.lang.Object).- Returns:
- the conditional
-
containsIgnoreCase
default C containsIgnoreCase(Object value)
Condition is true when thefield(java.lang.String)contains thevalue(java.lang.Object)ignoring case.- Returns:
- the conditional
-
notContains
default C notContains(Object value)
Condition is true when thefield(java.lang.String)does not contain thevalue(java.lang.Object).- Returns:
- the conditional
-
notContainsIgnoreCase
default C notContainsIgnoreCase(Object value)
Condition is true when thefield(java.lang.String)does not contain thevalue(java.lang.Object)ignoring case.- Returns:
- the conditional
-
-