- java.lang.Object
-
- io.github.bucket4j.Bandwidth
-
- All Implemented Interfaces:
ComparableByContent<Bandwidth>
public class Bandwidth extends Object implements ComparableByContent<Bandwidth>
-
-
Field Summary
Fields Modifier and Type Field Description static SerializationHandle<Bandwidth>SERIALIZATION_HANDLEstatic StringUNDEFINED_IDstatic longUNSPECIFIED_TIME_OF_FIRST_REFILL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static BandwidthBuilder.BandwidthBuilderCapacityStagebuilder()Creates a builder forBandwidthstatic Bandwidthclassic(long capacity, Refill refill)Deprecated.booleanequals(Object o)booleanequalsByContent(Bandwidth other)longgetCapacity()StringgetId()longgetInitialTokens()longgetRefillPeriodNanos()longgetRefillTokens()longgetTimeOfFirstRefillMillis()inthashCode()booleanhasId()booleanisGready()booleanisIntervallyAligned()booleanisRefillIntervally()booleanisUseAdaptiveInitialTokens()static Bandwidthsimple(long capacity, Duration period)Deprecated.StringtoString()BandwidthwithId(String id)Deprecated.BandwidthwithInitialTokens(long initialTokens)Deprecated.
-
-
-
Field Detail
-
UNDEFINED_ID
public static final String UNDEFINED_ID
-
UNSPECIFIED_TIME_OF_FIRST_REFILL
public static final long UNSPECIFIED_TIME_OF_FIRST_REFILL
- See Also:
- Constant Field Values
-
SERIALIZATION_HANDLE
public static final SerializationHandle<Bandwidth> SERIALIZATION_HANDLE
-
-
Method Detail
-
builder
public static BandwidthBuilder.BandwidthBuilderCapacityStage builder()
Creates a builder forBandwidth- Returns:
- a builder for
Bandwidth
-
simple
@Deprecated public static Bandwidth simple(long capacity, Duration period)
Deprecated.This method is deprecated, you should usebuilder()
-
classic
@Deprecated public static Bandwidth classic(long capacity, Refill refill)
Deprecated.This method is deprecated, you should usebuilder()
-
withInitialTokens
@Deprecated public Bandwidth withInitialTokens(long initialTokens)
Deprecated.This method is deprecated, you should useBandwidthBuilder.BandwidthBuilderBuildStage.initialTokens(long))}
-
withId
@Deprecated public Bandwidth withId(String id)
Deprecated.This method is deprecated, you should useBandwidthBuilder.BandwidthBuilderBuildStage.id(String)
-
isIntervallyAligned
public boolean isIntervallyAligned()
-
getTimeOfFirstRefillMillis
public long getTimeOfFirstRefillMillis()
-
getCapacity
public long getCapacity()
-
getInitialTokens
public long getInitialTokens()
-
getRefillPeriodNanos
public long getRefillPeriodNanos()
-
getRefillTokens
public long getRefillTokens()
-
isUseAdaptiveInitialTokens
public boolean isUseAdaptiveInitialTokens()
-
isRefillIntervally
public boolean isRefillIntervally()
-
isGready
public boolean isGready()
-
getId
public String getId()
-
hasId
public boolean hasId()
-
equalsByContent
public boolean equalsByContent(Bandwidth other)
- Specified by:
equalsByContentin interfaceComparableByContent<Bandwidth>
-
-