Class CustomerSegmentType
java.lang.Object
com.broadleafcommerce.customer.segments.CustomerSegmentType
- All Implemented Interfaces:
Serializable
Extensible enumeration defining customer segment types. (e.g. RULE_BASED, CUSTOMER_SET)
Consumers wishing to add additional CustomerSegment types should extend this class with an implementation similar to the following:
{
@code
public class CustomerSetSegmentType extends CustomerSegmentType {
public static final CustomerSegmentType CUSTOMER_SET =
new CustomerSetSegmentType("CUSTOMER_SET", true);
protected CustomerSetSegmentType(String type, boolean includeCustomers) {
super(type, includeCustomers);
}
}
}
For proper initialization, configuration is required. For example, to configure the type defined
above, we would add the annotation CustomerSegmentTypes to a Spring @Configuration class
as such:
{
@code
@CustomerSegmentTypes({CustomerSetSegmentType.class})
@Configuration
public class SpringConfigurationClass {}
}
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CustomerSegmentTypeA segment with a manually curated set of customers.static final CustomerSegmentTypeA segment that is a reference to a segment defined in an external system.static final CustomerSegmentTypeA segment where membership is determined by a rule. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomerSegmentType(@NonNull String type, boolean manuallyAddCustomers) Constructs aCustomerSegmentType. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanfinal booleanbooleanstatic CustomerSegmentTypefromString(String stringValue) static Collection<CustomerSegmentType>Retrieve all registered customer segment types.static CustomerSegmentTypegetInstance(String type) Returns an instance of a customer segment based on its String type.final StringgetType()inthashCode()static booleanisCustomerSet(String customerSegmentType) static booleanisExternal(String customerSegmentType) static booleanisRuleBased(String customerSegmentType) toString()
-
Field Details
-
RULE_BASED
A segment where membership is determined by a rule. This rule may be evaluated offline in a batch process against known registered customers in the data store or in real-time against request and auth data.- See Also:
-
CUSTOMER_SET
A segment with a manually curated set of customers. -
EXTERNAL
A segment that is a reference to a segment defined in an external system.
-
-
Constructor Details
-
CustomerSegmentType
Constructs aCustomerSegmentType. The convention is to use all capital letters with spaces represented as underscores (_)manuallyAddCustomersindicates whether or not individual customers may be added to this segment type. Attempts to add a customer to, say, a rule based segment are likely a mistake in logic.- Parameters:
type- the type of this customer segmentmanuallyAddCustomers- Can individual customers be manually added to this segment type?
-
-
Method Details
-
getType
- Returns:
- The String representation of this segment type.
-
canManuallyAddCustomers
public final boolean canManuallyAddCustomers()- Returns:
- Can individual customers be added to this segment type?
-
getInstance
Returns an instance of a customer segment based on its String type.- Parameters:
type- The type of this Customer Segment
-
getAllIndexableTypes
Retrieve all registered customer segment types. -
fromString
-
isRuleBased
-
isCustomerSet
-
isExternal
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-