java.lang.Object
live.crowdcontrol.cc4j.websocket.payload.CCName
All Implemented Interfaces:
Comparable<CCName>

public class CCName extends Object implements Comparable<CCName>
The name of an object. Encapsulates both the display name and the name for sorting.
  • Constructor Details

    • CCName

      public CCName(@NotNull @NotNull String displayName, @Nullable @Nullable String sort)
      Creates a name.
      Parameters:
      displayName - viewer-facing display name
      sort - name for alphabetical sorting
    • CCName

      public CCName(@NotNull @NotNull String displayName)
      Creates a name.
      Parameters:
      displayName - viewer-facing display name
  • Method Details

    • getDisplayName

      @NotNull public @NotNull String getDisplayName()
      Gets the name displayed to users.
      Returns:
      display name
    • getSortValue

      @Nullable public @Nullable String getSortValue()
      Gets the name used for alphabetical sorting. If null, fall back to getDisplayName().
      Returns:
      sort name
    • computeSortValue

      @NotNull public @NotNull String computeSortValue()
      Computes the name used for alphabetical sorting. Returns getSortValue() if present, else getDisplayName().
      Returns:
      computed sort name
    • compareTo

      public int compareTo(@NotNull @NotNull CCName o)
      Specified by:
      compareTo in interface Comparable<CCName>