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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CustomerSegmentType
A segment with a manually curated set of customers.static final CustomerSegmentType
A segment that is a reference to a segment defined in an external system.static final CustomerSegmentType
A segment where membership is determined by a rule. -
Constructor Summary
ModifierConstructorDescriptionprotected
CustomerSegmentType
(@NonNull String type, boolean manuallyAddCustomers) Constructs aCustomerSegmentType
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
final boolean
boolean
static CustomerSegmentType
fromString
(String stringValue) static Collection<CustomerSegmentType>
Retrieve all registered customer segment types.static CustomerSegmentType
getInstance
(String type) Returns an instance of a customer segment based on its String type.final String
getType()
int
hashCode()
static boolean
isCustomerSet
(String customerSegmentType) static boolean
isExternal
(String customerSegmentType) static boolean
isRuleBased
(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 (_)manuallyAddCustomers
indicates 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
-