Package org.jacoco.report.check
Class Limit
- java.lang.Object
-
- org.jacoco.report.check.Limit
-
public class Limit extends java.lang.Object
Descriptor for a limit which is given by aRule
.
-
-
Field Summary
Fields Modifier and Type Field Description private ICoverageNode.CounterEntity
entity
private static java.util.Map<ICoverageNode.CounterEntity,java.lang.String>
ENTITY_NAMES
private java.math.BigDecimal
maximum
private java.math.BigDecimal
minimum
private ICounter.CounterValue
value
private static java.util.Map<ICounter.CounterValue,java.lang.String>
VALUE_NAMES
-
Constructor Summary
Constructors Constructor Description Limit()
Creates a new instance with the following defaults: counter entity:ICoverageNode.CounterEntity.INSTRUCTION
counter value:ICounter.CounterValue.COVEREDRATIO
minimum: no limit maximum: no limit
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.String
check(ICoverageNode node)
private java.lang.String
checkRatioLimit()
private java.lang.String
checkRatioLimit(java.lang.String minmax, java.math.BigDecimal v)
ICoverageNode.CounterEntity
getEntity()
java.lang.String
getMaximum()
java.lang.String
getMinimum()
ICounter.CounterValue
getValue()
private java.lang.String
message(java.lang.String minmax, java.math.BigDecimal v, java.math.BigDecimal ref, java.math.RoundingMode mode)
private static java.math.BigDecimal
parseValue(java.lang.String value)
void
setCounter(java.lang.String entity)
Sets the counter entity to check.void
setMaximum(java.lang.String maximum)
Sets the expected maximum value.void
setMinimum(java.lang.String minimum)
Sets the expected minimum value.void
setValue(java.lang.String value)
Sets the value to check.
-
-
-
Field Detail
-
VALUE_NAMES
private static final java.util.Map<ICounter.CounterValue,java.lang.String> VALUE_NAMES
-
ENTITY_NAMES
private static final java.util.Map<ICoverageNode.CounterEntity,java.lang.String> ENTITY_NAMES
-
entity
private ICoverageNode.CounterEntity entity
-
value
private ICounter.CounterValue value
-
minimum
private java.math.BigDecimal minimum
-
maximum
private java.math.BigDecimal maximum
-
-
Constructor Detail
-
Limit
public Limit()
Creates a new instance with the following defaults:- counter entity:
ICoverageNode.CounterEntity.INSTRUCTION
- counter value:
ICounter.CounterValue.COVEREDRATIO
- minimum: no limit
- maximum: no limit
- counter entity:
-
-
Method Detail
-
getEntity
public ICoverageNode.CounterEntity getEntity()
- Returns:
- the configured counter entity to check
-
setCounter
public void setCounter(java.lang.String entity)
Sets the counter entity to check.- Parameters:
entity
- counter entity to check
-
getValue
public ICounter.CounterValue getValue()
- Returns:
- the configured value to check
-
setValue
public void setValue(java.lang.String value)
Sets the value to check.- Parameters:
value
- value to check
-
getMinimum
public java.lang.String getMinimum()
- Returns:
- configured minimum value, or
null
if no minimum is given
-
setMinimum
public void setMinimum(java.lang.String minimum)
Sets the expected minimum value. If the minimum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
minimum
- allowed minimum ornull
, if no minimum should be checked
-
getMaximum
public java.lang.String getMaximum()
- Returns:
- configured maximum value, or
null
if no maximum is given
-
setMaximum
public void setMaximum(java.lang.String maximum)
Sets the expected maximum value. If the maximum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
maximum
- allowed maximum ornull
, if no maximum should be checked
-
parseValue
private static java.math.BigDecimal parseValue(java.lang.String value)
-
check
java.lang.String check(ICoverageNode node)
-
message
private java.lang.String message(java.lang.String minmax, java.math.BigDecimal v, java.math.BigDecimal ref, java.math.RoundingMode mode)
-
checkRatioLimit
private java.lang.String checkRatioLimit()
-
checkRatioLimit
private java.lang.String checkRatioLimit(java.lang.String minmax, java.math.BigDecimal v)
-
-