Interface IHCHasID<IMPLTYPE extends IHCHasID<IMPLTYPE>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default IMPLTYPE ensureID()
      Set a new ID if none is present.
      String getID()
      Get the HTML ID of this object.
      Note: we cannot use IHasID<String> because the constraint of IHasID is, that the returned ID may not be null whereas here the HTML ID can be null!
      default boolean hasID()  
      default boolean hasNoID()  
      IMPLTYPE setID​(String sID)
      Set the HTML ID of this object.
      default IMPLTYPE setUniqueID()
      Set a unique HTML ID for this object.
      • Methods inherited from interface com.helger.commons.traits.IGenericImplTrait

        thisAsT
    • Method Detail

      • getID

        @Nullable
        String getID()
        Get the HTML ID of this object.
        Note: we cannot use IHasID<String> because the constraint of IHasID is, that the returned ID may not be null whereas here the HTML ID can be null!
        Returns:
        The HTML ID of this object.
      • hasID

        default boolean hasID()
        Returns:
        true if this element has an ID, false if not.
      • hasNoID

        default boolean hasNoID()
        Returns:
        true if this element has no ID, false if it has one.
      • setID

        @Nonnull
        IMPLTYPE setID​(@Nullable
                       String sID)
        Set the HTML ID of this object.
        Parameters:
        sID - The ID to use. Must conform to the HTML rules for an element ID.
        Returns:
        this
      • setUniqueID

        @Nonnull
        default IMPLTYPE setUniqueID()
        Set a unique HTML ID for this object. Equal to setID (GlobalIDFactory.getNewStringID ())
        Returns:
        this
      • ensureID

        @Nonnull
        default IMPLTYPE ensureID()
        Set a new ID if none is present. This is a shortcut for if (!hasID())setUniqueID ();
        Returns:
        this