java.lang.Object
org.microbean.type.Type.Semantics
org.microbean.type.Type.VariantSemantics
org.microbean.type.Type.InvariantSemantics
A
Type.VariantSemantics
implementation that does not permit
subtyping, but that compares wildcard types covariantly.- Author:
- Laird Nelson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Type.InvariantSemantics
An instance ofType.InvariantSemantics
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<X,
Y> boolean assignable
(Type<X> receiverType, Type<Y> payloadType) Returnstrue
if and only if a reference bearing the type modeled by the suppliedpayloadType
is assignable to a reference bearing the type modeled by the suppliedreceiverType
, according to the assignability rules modeled by thisType.Semantics
instance.Methods inherited from class org.microbean.type.Type.VariantSemantics
classIsAssignableFromClass, genericArrayTypeIsAssignableFromGenericArrayType
Methods inherited from class org.microbean.type.Type.Semantics
assignable, assignable, classIsAssignableFromGenericArrayType, classIsAssignableFromParameterizedType, classIsAssignableFromTypeVariable, classIsAssignableFromWildcardType, genericArrayTypeIsAssignableFromClass, genericArrayTypeIsAssignableFromParameterizedType, genericArrayTypeIsAssignableFromTypeVariable, genericArrayTypeIsAssignableFromWildcardType, parameterizedTypeIsAssignableFromClass, parameterizedTypeIsAssignableFromGenericArrayType, parameterizedTypeIsAssignableFromParameterizedType, parameterizedTypeIsAssignableFromTypeVariable, parameterizedTypeIsAssignableFromWildcardType, typeVariableIsAssignableFromClass, typeVariableIsAssignableFromGenericArrayType, typeVariableIsAssignableFromParameterizedType, typeVariableIsAssignableFromTypeVariable, typeVariableIsAssignableFromWildcardType, wildcardTypeIsAssignableFromClass, wildcardTypeIsAssignableFromGenericArrayType, wildcardTypeIsAssignableFromParameterizedType, wildcardTypeIsAssignableFromTypeVariable, wildcardTypeIsAssignableFromWildcardType
-
Field Details
-
INSTANCE
An instance ofType.InvariantSemantics
.- Nullability:
- This field is never
null
.
-
-
Constructor Details
-
InvariantSemantics
public InvariantSemantics()Creates a newType.InvariantSemantics
.
-
-
Method Details
-
assignable
Description copied from class:Type.Semantics
Returnstrue
if and only if a reference bearing the type modeled by the suppliedpayloadType
is assignable to a reference bearing the type modeled by the suppliedreceiverType
, according to the assignability rules modeled by thisType.Semantics
instance.- Overrides:
assignable
in classType.Semantics
- Type Parameters:
X
- the kind of type modeled by thereceiverType
; often ajava.lang.reflect.Type
Y
- the kind of type modeled by thepayloadType
; often ajava.lang.reflect.Type
- Parameters:
receiverType
- the receiver type as described above; must not benull
payloadType
- the payload type as described above; must not benull
- Returns:
true
if and only if a reference bearing the type modeled by the suppliedpayloadType
is assignable to a reference bearing the type modeled by the suppliedreceiverType
, according to the assignability rules modeled by thisType.Semantics
instance;false
otherwise
-