Interface Assigner
-
- All Known Implementing Classes:
Assigner.EqualTypesOnly,Assigner.Refusing,GenericTypeAwareAssigner,PrimitiveTypeAwareAssigner,ReferenceTypeAwareAssigner,VoidAwareAssigner
public interface AssignerAn assigner is responsible for converting some typeAto another typeBif 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 Classes Modifier and Type Interface Description static classAssigner.EqualTypesOnlyAn assigner that only allows to assign types if they are equal to another.static classAssigner.RefusingAn assigner that does not allow any assignments.static classAssigner.TypingIndicates for a type assignment, if a type casting should be applied in case that two types are not statically assignable.
-
Field Summary
Fields Modifier and Type Field Description static AssignerDEFAULTA default assigner that can handlevoid, primitive types and reference types which considers generic types as raw types.static AssignerGENERICS_AWAREA generics-aware assigner that can handlevoid, primitive types which reference types.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StackManipulationassign(TypeDescription.Generic source, TypeDescription.Generic target, Assigner.Typing typing)
-
-
-
Field Detail
-
DEFAULT
static final Assigner DEFAULT
A default assigner that can handlevoid, primitive types and reference types which considers generic types as raw types.
-
GENERICS_AWARE
static final Assigner GENERICS_AWARE
A generics-aware assigner that can handlevoid, primitive types which reference types.
-
-
Method Detail
-
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 thesourceTypeis 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 thatvoidto non-voidassignments are permitted.- Returns:
- A stack manipulation that transforms the
sourceTypeinto thetargetTypeif this is possible. An illegal stack manipulation otherwise.
-
-