Class CustomerSegmentType
- java.lang.Object
-
- com.broadleafcommerce.customer.segments.CustomerSegmentType
-
- All Implemented Interfaces:
Serializable
public class CustomerSegmentType extends Object implements 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:
CustomerSegmentTypes
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CustomerSegmentType.CustomerSegmentTypeConverter
-
Field Summary
Fields Modifier and Type Field Description static CustomerSegmentType
CUSTOMER_SET
A segment type with a pre-defined set of customers.static CustomerSegmentType
RULE_BASED
A rule based segment type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CustomerSegmentType(@NonNull String type, boolean manuallyAddCustomers)
Constructs aCustomerSegmentType
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
canManuallyAddCustomers()
boolean
equals(Object o)
static CustomerSegmentType
fromString(String stringValue)
static Collection<CustomerSegmentType>
getAllIndexableTypes()
Retrieve all registered customer segment types.static CustomerSegmentType
getInstance(String type)
Returns an instance of a customer segment based on its String type.String
getType()
int
hashCode()
String
toString()
-
-
-
Field Detail
-
RULE_BASED
public static final CustomerSegmentType RULE_BASED
A rule based segment type. Segments of this type require specific criteria to be met for a customer to qualify.
-
CUSTOMER_SET
public static final CustomerSegmentType CUSTOMER_SET
A segment type with a pre-defined set of customers.
-
-
Constructor Detail
-
CustomerSegmentType
protected CustomerSegmentType(@NonNull @NonNull String type, boolean manuallyAddCustomers)
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 Detail
-
getType
public final String 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
public static CustomerSegmentType getInstance(String type)
Returns an instance of a customer segment based on its String type.- Parameters:
type
- The type of this Customer Segment
-
getAllIndexableTypes
public static Collection<CustomerSegmentType> getAllIndexableTypes()
Retrieve all registered customer segment types.
-
fromString
public static CustomerSegmentType fromString(String stringValue)
-
canEqual
protected boolean canEqual(Object other)
-
-