Package com.io7m.jaffirm.core
Class ContractLongCondition
- java.lang.Object
-
- com.io7m.jaffirm.core.ContractLongCondition
-
- All Implemented Interfaces:
ContractLongConditionType
public final class ContractLongCondition extends java.lang.Object implements ContractLongConditionType
Alongspecialized version of theContractConditionTypetype.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContractLongCondition.BuilderBuilds instances of typeContractLongCondition.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContractLongCondition.Builderbuilder()Creates a builder forContractLongCondition.static ContractLongConditioncopyOf(ContractLongConditionType instance)Creates an immutable copy of aContractLongConditionTypevalue.java.util.function.LongFunction<java.lang.String>describer()booleanequals(java.lang.Object another)This instance is equal to all instances ofContractLongConditionthat have equal attribute values.inthashCode()Computes a hash code from attributes:predicate,describer.static ContractLongConditionof(java.util.function.LongPredicate predicate, java.util.function.LongFunction<java.lang.String> describer)Construct a new immutableContractLongConditioninstance.java.util.function.LongPredicatepredicate()java.lang.StringtoString()Prints the immutable valueContractLongConditionwith attribute values.ContractLongConditionwithDescriber(java.util.function.LongFunction<java.lang.String> value)Copy the current immutable object by setting a value for thedescriberattribute.ContractLongConditionwithPredicate(java.util.function.LongPredicate value)Copy the current immutable object by setting a value for thepredicateattribute.
-
-
-
Method Detail
-
predicate
public java.util.function.LongPredicate predicate()
- Specified by:
predicatein interfaceContractLongConditionType- Returns:
- A predicate that must evaluate to
truefor the contract to hold
-
describer
public java.util.function.LongFunction<java.lang.String> describer()
- Specified by:
describerin interfaceContractLongConditionType- Returns:
- A function that returns a textual description of the predicate
-
withPredicate
public final ContractLongCondition withPredicate(java.util.function.LongPredicate 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 ContractLongCondition withDescriber(java.util.function.LongFunction<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 ofContractLongConditionthat 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 valueContractLongConditionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static ContractLongCondition of(java.util.function.LongPredicate predicate, java.util.function.LongFunction<java.lang.String> describer)
Construct a new immutableContractLongConditioninstance.- Parameters:
predicate- The value for thepredicateattributedescriber- The value for thedescriberattribute- Returns:
- An immutable ContractLongCondition instance
-
copyOf
public static ContractLongCondition copyOf(ContractLongConditionType instance)
Creates an immutable copy of aContractLongConditionTypevalue. 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 ContractLongCondition instance
-
builder
public static ContractLongCondition.Builder builder()
Creates a builder forContractLongCondition.- Returns:
- A new ContractLongCondition builder
-
-