Interface Assigner
-
- All Known Implementing Classes:
Assigner.EqualTypesOnly
,Assigner.Refusing
,GenericTypeAwareAssigner
,PrimitiveTypeAwareAssigner
,ReferenceTypeAwareAssigner
,VoidAwareAssigner
public interface Assigner
An assigner is responsible for converting some typeA
to another typeB
if possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Assigner.EqualTypesOnly
An assigner that only allows to assign types if they are equal to another.static class
Assigner.Refusing
An assigner that does not allow any assignments.static class
Assigner.Typing
Indicates 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 Assigner
DEFAULT
A default assigner that can handlevoid
, primitive types and reference types which considers generic types as raw types.static Assigner
GENERICS_AWARE
A generics-aware assigner that can handlevoid
, primitive types which reference types.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StackManipulation
assign(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 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.
-
-