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 Classes
    Modifier and Type
    Interface
    Description
    static 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
    Modifier and Type
    Field
    Description
    static final Assigner
    A default assigner that can handle void, primitive types and reference types which considers generic types as raw types.
    static final Assigner
    A generics-aware assigner that can handle void, primitive types which reference types.
  • Method Summary

    Modifier and Type
    Method
    Description
     
  • Field Details

    • DEFAULT

      static final Assigner DEFAULT
      A default assigner that can handle void, 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 handle void, primitive types which reference types.
  • Method Details

    • assign

      Parameters:
      source - The original type that is to be transformed into the targetType.
      target - The target type into which the sourceType 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 that void to non-void assignments are permitted.
      Returns:
      A stack manipulation that transforms the sourceType into the targetType if this is possible. An illegal stack manipulation otherwise.