Enum Class Variance
- All Implemented Interfaces:
Serializable
,Comparable<Variance>
,Constable
Represents the result of a
TypeSet.testVariance(nz.org.riskscape.engine.types.Type,nz.org.riskscape.engine.types.Type)
NB The terminology is borrowed loosely from computer science, but It is doubtful that it matches any of the strict definitions that exist in other strictly typed, polymorphic, genericized languages.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe rule says that values of source type can safely be assigned to the target, even though they are not an exact match.The rule says that values of source type can safely be assigned to the target, and appear to be an exact match.The rule says that values of source type can not be safely assigned to the target.This rule is not applicable for the given types - not a yes or a no. -
Method Summary
-
Enum Constant Details
-
UNKNOWN
This rule is not applicable for the given types - not a yes or a no. Try again, caller.
-
INVARIANT
The rule says that values of source type can not be safely assigned to the target.
-
COVARIANT
The rule says that values of source type can safely be assigned to the target, even though they are not an exact match. This must mean that the underlying java types are themselves co-variant.
-
EQUAL
The rule says that values of source type can safely be assigned to the target, and appear to be an exact match. TODO - should this mean that
source.equals(target) = true
?
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
min
- Returns:
- the lowest variance from those given. This is like saying of these two possible assignments, this is the worst case
-