Class Segment

java.lang.Object
com.day.cq.personalization.Segment

public class Segment extends Object
The Segment class is a server-side representation of a segment which may be assigned to a user.

Since AEM segments are resolved client-side, this class makes a best-effort approach to represent the segments on the server side, but some precision may be lost. For instance, script segments will not have their scripts loaded by this segment, but will rather be referenced as Segment.Kind.ClientOnly segments.

This class is intended to be used, but not extended by consumers.

  • Field Details

  • Method Details

    • newLogicSegment

      public static Segment newLogicSegment(Segment.Kind kind)
    • newDirectSegment

      public static Segment newDirectSegment(String name, String operator, String value)
    • newDirectSegment

      public static Segment newDirectSegment(String name, String operator, List<String> values)
    • newExternalReferenceSegment

      public static Segment newExternalReferenceSegment(String name, String operator, String externalId)
    • newByPathSegment

      public static Segment newByPathSegment(String path)
      Creates a new ClientOnly segment instance
      Parameters:
      path - the repository location of the segment
      Returns:
      a new segment instance
    • getKind

      public Segment.Kind getKind()
    • getName

      public String getName()
    • getOperator

      public String getOperator()
    • getValue

      public List<String> getValue()
    • getChildren

      public List<Segment> getChildren()
    • addChild

      public void addChild(Segment resolvedSegment)
    • toString

      public String toString()
      Overrides:
      toString in class Object