public.javadoc.org.spincast.plugins.attemptslimiter.AttemptDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
AttemptDefault (org.spincast:spincast-framework 1.2.0 API)
org.spincast.plugins.attemptslimiter
Class AttemptDefault
- java.lang.Object
-
- org.spincast.plugins.attemptslimiter.AttemptDefault
-
-
Constructor Summary
Constructors
Constructor and Description
AttemptDefault(SpincastAttemptsLimiterPluginRepository spincastAttemptsLimiterPlguinRepository,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig,
boolean maxReached,
String actionName,
AttemptCriteria... criterias)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
void
deleteAttempts()
Deletes all attempts for this action and criterias.
String
getActionName()
AttemptCriteria[]
getCriterias()
protected SpincastAttemptsLimiterPluginConfig
getSpincastAttemptsLimiterPluginConfig()
protected SpincastAttemptsLimiterPluginRepository
getSpincastAttemptsLimiterPluginRepository()
void
incrementAttemptsCount()
Increments the number of attempts.
boolean
isMaxReached()
Max number of attempts reached.
String
toString()
-
-
Constructor Detail
-
AttemptDefault
public AttemptDefault(SpincastAttemptsLimiterPluginRepository spincastAttemptsLimiterPlguinRepository,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig,
boolean maxReached,
String actionName,
AttemptCriteria... criterias)
-
Method Detail
-
getSpincastAttemptsLimiterPluginRepository
protected SpincastAttemptsLimiterPluginRepository getSpincastAttemptsLimiterPluginRepository()
-
getSpincastAttemptsLimiterPluginConfig
protected SpincastAttemptsLimiterPluginConfig getSpincastAttemptsLimiterPluginConfig()
-
getActionName
public String getActionName()
-
getCriterias
public AttemptCriteria[] getCriterias()
-
isMaxReached
public boolean isMaxReached()
Description copied from interface: Attempt
Max number of attempts reached. Your
code should deny the protected action.
- Specified by:
isMaxReached
in interface Attempt
-
incrementAttemptsCount
public void incrementAttemptsCount()
Description copied from interface: Attempt
Increments the number of attempts.
You have to call this method manually if
you don't let the AttemptsManager.attempt(String, org.spincast.plugins.attemptslimiter.AttemptCriteria...)
method do it.
Note that calling this method multiple times won't result in
multiple increments. The count will be incremented only once!
- Specified by:
incrementAttemptsCount
in interface Attempt
- See Also:
SpincastAttemptsLimiterPluginConfig#getDefaultAttemptAutoIncrementType()}
and {@link AttemptsManager#attempt(String, AttemptAutoIncrementType, AttemptCriteria...)}.
-
deleteAttempts
public void deleteAttempts()
Description copied from interface: Attempt
Deletes all attempts for this action and criterias.
In some situations, you may want to clear the attempts
when an action is succesfull.
- Specified by:
deleteAttempts
in interface Attempt
Copyright © 2019. All rights reserved.