Package io.wcm.handler.link.type.helpers
Class LinkResolveCounter
java.lang.Object
io.wcm.handler.link.type.helpers.LinkResolveCounter
Counts number of recursive link resolve requests to detect endless loops.
Max. 5 hops are allowed in
isMaximumReached() method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDecrease counter by 1.static @NotNull LinkResolveCounterget()Get counter instance.intgetCount()Get counter value.voidIncrease counter by 1.booleanCheck if maximum is reached.
-
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
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.
-