Package com.io7m.jaffirm.core
Class ContractIntCondition
- java.lang.Object
-
- com.io7m.jaffirm.core.ContractIntCondition
-
- All Implemented Interfaces:
ContractIntConditionType
public final class ContractIntCondition extends java.lang.Object implements ContractIntConditionType
Anintspecialized version of theContractConditionTypetype.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContractIntCondition.BuilderBuilds instances of typeContractIntCondition.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContractIntCondition.Builderbuilder()Creates a builder forContractIntCondition.static ContractIntConditioncopyOf(ContractIntConditionType instance)Creates an immutable copy of aContractIntConditionTypevalue.java.util.function.IntFunction<java.lang.String>describer()booleanequals(java.lang.Object another)This instance is equal to all instances ofContractIntConditionthat have equal attribute values.inthashCode()Computes a hash code from attributes:predicate,describer.static ContractIntConditionof(java.util.function.IntPredicate predicate, java.util.function.IntFunction<java.lang.String> describer)Construct a new immutableContractIntConditioninstance.java.util.function.IntPredicatepredicate()java.lang.StringtoString()Prints the immutable valueContractIntConditionwith attribute values.ContractIntConditionwithDescriber(java.util.function.IntFunction<java.lang.String> value)Copy the current immutable object by setting a value for thedescriberattribute.ContractIntConditionwithPredicate(java.util.function.IntPredicate value)Copy the current immutable object by setting a value for thepredicateattribute.
-
-
-
Method Detail
-
predicate
public java.util.function.IntPredicate predicate()
- Specified by:
predicatein interfaceContractIntConditionType- Returns:
- A predicate that must evaluate to
truefor the contract to hold
-
describer
public java.util.function.IntFunction<java.lang.String> describer()
- Specified by:
describerin interfaceContractIntConditionType- Returns:
- A function that returns a textual description of the predicate
-
withPredicate
public final ContractIntCondition withPredicate(java.util.function.IntPredicate value)
Copy the current immutable object by setting a value for thepredicateattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for predicate- Returns:
- A modified copy of the
thisobject
-
withDescriber
public final ContractIntCondition withDescriber(java.util.function.IntFunction<java.lang.String> value)
Copy the current immutable object by setting a value for thedescriberattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for describer- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofContractIntConditionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:predicate,describer.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueContractIntConditionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static ContractIntCondition of(java.util.function.IntPredicate predicate, java.util.function.IntFunction<java.lang.String> describer)
Construct a new immutableContractIntConditioninstance.- Parameters:
predicate- The value for thepredicateattributedescriber- The value for thedescriberattribute- Returns:
- An immutable ContractIntCondition instance
-
copyOf
public static ContractIntCondition copyOf(ContractIntConditionType instance)
Creates an immutable copy of aContractIntConditionTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable ContractIntCondition instance
-
builder
public static ContractIntCondition.Builder builder()
Creates a builder forContractIntCondition.- Returns:
- A new ContractIntCondition builder
-
-