Package org.jboss.resteasy.spi.config
Class Threshold
java.lang.Object
org.jboss.resteasy.spi.config.Threshold
Represents a threshold for a unit size.
- Author:
- James R. Perkins
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static ThresholdCreates a new threshold.booleanreached(long size) Checks if the given size is greater than the bytes available for the threshold.sizeUnit()Returns the size unit for this threshold.longtoBytes()The size in bytes for this threshold.toString()static ThresholdParses the given string representation of a threshold.
-
Field Details
-
NONE
-
DEFAULT
-
-
Method Details
-
of
Creates a new threshold.If the
sizeis less than 0, then theNONEinstance is returned regardless of theunit.- Parameters:
size- the maximum size of the thresholdunit- the unit of measurement to calculate the size in bytes
-
toBytes
public long toBytes()The size in bytes for this threshold.- Returns:
- the size in bytes
-
sizeUnit
Returns the size unit for this threshold.- Returns:
- the size unit
-
reached
public boolean reached(long size) Checks if the given size is greater than the bytes available for the threshold.- Parameters:
size- the size to validate- Returns:
falseif the size is greater than the bytes allowed for this threshold, otherwisetrue
-
hashCode
public int hashCode() -
valueOf
Parses the given string representation of a threshold. For example a value of "1MB" would return a threshold with a size of 1 megabyte.- Parameters:
value- the value to parse- Returns:
- a threshold based on the parsed string
-
equals
-
toString
-