Package com.levigo.jadice.server
Class Limits
- java.lang.Object
-
- com.levigo.jadice.server.Limits
-
- All Implemented Interfaces:
Serializable
public class Limits extends Object implements Serializable
This class acts as a convenient container for a set ofLimit
s.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Limit limit)
Add a limit.<L extends Limit>
Collection<L>get(Class<L> type)
<L extends Limit>
Collection<L>get(Class<L> type, Limit.WhenExceedAction action)
<L extends Limit>
LgetMostRestrictive(Class<L> type, Limit.WhenExceedAction action)
Find the most restrictiveLimit
of the the given type andexceed action
Limits
merge(Limits other, boolean ignoreAborts)
Return new Limits which contains the limits of this instance merged with the limits represented by the parameterl
.boolean
remove(Limit limit)
Remove a previously appliedLimit
.
-
-
-
Constructor Detail
-
Limits
public Limits()
Default constructor
-
Limits
public Limits(Limits other)
Copy constructor (no deep-copy)- Parameters:
other
- they instance to copy – Limits will not be cloned.
-
-
Method Detail
-
remove
public boolean remove(Limit limit)
Remove a previously appliedLimit
. This call will have no effect, if the limit has not been applied previously.- Parameters:
limit
- The limit to remove- Returns:
true
iff the limit to remove was contained in this container
-
get
public <L extends Limit> Collection<L> get(Class<L> type)
-
get
public <L extends Limit> Collection<L> get(Class<L> type, Limit.WhenExceedAction action)
-
getMostRestrictive
public <L extends Limit> L getMostRestrictive(Class<L> type, Limit.WhenExceedAction action)
Find the most restrictiveLimit
of the the given type andexceed action
-
merge
public Limits merge(Limits other, boolean ignoreAborts)
Return new Limits which contains the limits of this instance merged with the limits represented by the parameterl
. IfignoreAborts
is set totrue
, all limits with ActionLimit.WhenExceedAction.ABORT
from the instancel
are dropped.- Parameters:
other
- the Limits to merge withignoreAborts
- whether or not to ignoreabort actions
- Returns:
- the merged Limits
-
-