Class LinkResolveCounter

java.lang.Object
io.wcm.handler.link.type.helpers.LinkResolveCounter

public final class LinkResolveCounter extends Object
Counts number of recursive link resolve requests to detect endless loops. Max. 5 hops are allowed in isMaximumReached() method.
  • Constructor Details

    • LinkResolveCounter

      public LinkResolveCounter()
  • Method Details

    • getCount

      public int getCount()
      Get counter value.
      Returns:
      Counter value
    • increaseCount

      public void increaseCount()
      Increase counter by 1.
    • decreaseCount

      public void decreaseCount()
      Decrease counter by 1. If 0 is reached the counter instance is removed from the current thread.
    • isMaximumReached

      public boolean isMaximumReached()
      Check if maximum is reached.
      Returns:
      true if maximum of allowed recursion steps is reached.
    • get

      @NotNull public static @NotNull LinkResolveCounter get()
      Get counter instance.
      Returns:
      Counter for current request/thread. If instance was not set in thread before it is newly created and attached to the current thread.