Interface Assigner
- All Known Implementing Classes:
Assigner.EqualTypesOnly
,Assigner.Refusing
,GenericTypeAwareAssigner
,PrimitiveTypeAwareAssigner
,ReferenceTypeAwareAssigner
,VoidAwareAssigner
public interface Assigner
An assigner is responsible for converting some type
A
to another type B
if possible.
An assigner is for example responsible for type casting, auto boxing or unboxing or for the widening of primitive types.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
An assigner that only allows to assign types if they are equal to another.static enum
An assigner that does not allow any assignments.static enum
Indicates for a type assignment, if a type casting should be applied in case that two types are not statically assignable. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionassign
(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
-
Field Details
-
DEFAULT
A default assigner that can handlevoid
, primitive types and reference types which considers generic types as raw types. -
GENERICS_AWARE
A generics-aware assigner that can handlevoid
, primitive types which reference types.
-
-
Method Details
-
assign
StackManipulation assign(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing) - Parameters:
source
- The original type that is to be transformed into thetargetType
.target
- The target type into which thesourceType
is to be converted.typing
- A hint whether the assignment should consider the runtime type of the source type, i.e. if type down or cross castings are allowed. If this hint is set, this is also an indication thatvoid
to non-void
assignments are permitted.- Returns:
- A stack manipulation that transforms the
sourceType
into thetargetType
if this is possible. An illegal stack manipulation otherwise.
-