UTIL_Limits.LimitCheck
Class
global class UTIL_Limits.LimitCheckFluent limit inspector scoped to a single governor limit type. Provides methods to check remaining budget, usage percentage, exhaustion, and threshold proximity.
Methods
| Method | Description |
|---|---|
| global Boolean isExhausted() | Returns whether the limit has been fully consumed (no remaining budget). |
| global Boolean isNearLimit(Decimal threshold) | Returns whether usage has reached or exceeded the given threshold. |
| global Integer maximum() | Returns the maximum allowed units for this limit type. |
| global Decimal percentUsed() | Returns the percentage of the limit consumed as a value between 0.0 and 1.0. |
| global Integer remaining() | Returns the number of limit units remaining before the governor limit is hit. |
| global Integer used() | Returns the number of limit units consumed in this transaction. |
isExhausted
global Boolean isExhausted()Returns whether the limit has been fully consumed (no remaining budget).
Returns Boolean — True when remaining() is less than or equal to zero
isNearLimit
global Boolean isNearLimit(Decimal threshold)Returns whether usage has reached or exceeded the given threshold. Values greater than 1.0 are automatically normalised by dividing by 100 (e.g. 80 becomes 0.8).
Parameters
| Parameter | Type | Description |
|---|---|---|
threshold | Decimal | The threshold as a decimal (0.0–1.0) or percentage (e.g. 80 for 80%) |
Returns Boolean — True when percentUsed() is at or above the normalised threshold
maximum
global Integer maximum()Returns the maximum allowed units for this limit type.
Returns Integer — Governor limit maximum
percentUsed
global Decimal percentUsed()Returns the percentage of the limit consumed as a value between 0.0 and 1.0.
Returns Decimal — Usage percentage (0.0 = none used, 1.0 = fully exhausted)
remaining
global Integer remaining()Returns the number of limit units remaining before the governor limit is hit.
Returns Integer — Remaining budget (maximum - used)
used
global Integer used()Returns the number of limit units consumed in this transaction.
Returns Integer — Current usage count
Fields
| Field | Description |
|---|---|
| global final String label | The human-readable label for this limit type (e.g. |
label
global final String labelType: String
The human-readable label for this limit type (e.g. "Callouts", "Queries").