public final class StandardMethodContract extends MethodContract
StandardMethodContract.ValueConstraint
constraints on arguments.
Such contract can be created from org.jetbrains.annotations.Contract
annotation.Modifier and Type | Class and Description |
---|---|
static class |
StandardMethodContract.ParseException |
static class |
StandardMethodContract.ValueConstraint |
Constructor and Description |
---|
StandardMethodContract(StandardMethodContract.ValueConstraint [] parameters,
ContractReturnValue returnValue) |
getReturnValue, isTrivial, singleConditionContract, toNonIntersectingContracts, toString, trivialContract
public StandardMethodContract(StandardMethodContract.ValueConstraint [] parameters, ContractReturnValue returnValue)
public int getParameterCount()
public StandardMethodContract.ValueConstraint getParameterConstraint(int parameterIndex)
public java.util.List<StandardMethodContract.ValueConstraint> getConstraints()
public StandardMethodContract withReturnValue(ContractReturnValue returnValue)
public static StandardMethodContract trivialContract(int paramCount, ContractReturnValue returnValue)
public StandardMethodContract tryCollapse(StandardMethodContract other)
other
- other contract to merge into thispublic static java.util.List<StandardMethodContract> toNonIntersectingStandardContracts(java.util.List<StandardMethodContract> contracts)
"null -> null, _ -> !null"
will be converted to "null -> null, !null -> !null"
). Also removes unreachable
contracts if any.contracts
- list of input contracts to process (assumed that they are applied in the specified order)public static StandardMethodContract.ValueConstraint [] createConstraintArray(int paramCount)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.List<ContractValue> getConditions()
getConditions
in class MethodContract
public static java.util.List<StandardMethodContract> parseContract(java.lang.String text) throws StandardMethodContract.ParseException