Class AbstractMemberExpansionTransformer<T extends IMemberAccessExpression>

Direct Known Subclasses:
BeanMethodCallExpansionTransformer, MemberExpansionAccessTransformer

public abstract class AbstractMemberExpansionTransformer<T extends IMemberAccessExpression> extends AbstractExpressionTransformer<T>
  • Constructor Details

  • Method Details

    • createIterationExpr

      protected abstract IRExpression createIterationExpr(IType rootComponentType, String identifierName, IType identifierType, IType compType)
      Subclassers need only implement this method for the iteration expression i.e., the singular form of the expansion expr.
    • getPropertyOrMethodType

      protected abstract IType getPropertyOrMethodType(IType rootComponentType, IType compType)
    • compile_impl

      protected IRExpression compile_impl()
      Specified by:
      compile_impl in class AbstractExpressionTransformer<T extends IMemberAccessExpression>
    • isArrayOrCollection

      private static boolean isArrayOrCollection(IType type)
    • compileExpansionWithNoReturnValue

      protected IRExpression compileExpansionWithNoReturnValue(IType rootType, IType rootComponentType, IType resultType, IType resultCompType)
    • createNoValueLoop

      private IRForEachStatement createNoValueLoop(IType rootType, IType rootComponentType, IType resultCompType, IRSymbol tempRoot)
    • compileExpansionDirectlyToArray

      protected IRExpression compileExpansionDirectlyToArray(IType rootType, IType rootComponentType, IType resultType, IType resultCompType)
      If this method is being called, it means we're expanding a one-dimensional array or collection, with a right hand side that evaluates to a property that's not an array or collection. In that case, we build up an array and simply store values directly into it. We also null-short-circuit in the event that the root is null. The member expansion portion ends up as a composite that looks like: temp_array = new Foo[temp_root.length] for (a in temp_root index i) { temp_array[i] = a.Bar } temp_array And the overall expression looks like: temp_root = root ( temp_root == null ? (Bar[]) null : (Bar[]) member_expansion )
    • makeArray

      private IRExpression makeArray(IType componentType, IRExpression lengthExpression)
    • createArrayLengthExpression

      private IRExpression createArrayLengthExpression(IType rootType, IRSymbol tempRoot)
    • createArrayStoreLoop

      private IRForEachStatement createArrayStoreLoop(IType rootType, IType rootComponentType, IType resultCompType, IRSymbol tempRoot, IRSymbol resultArray)
    • compileExpansionUsingArrayList

      protected IRExpression compileExpansionUsingArrayList(IType rootType, IType rootComponentType, IType resultType, IType resultCompType, IType propertyType)
      This method will compile the expansion using an ArrayList to collect temporary results. This is appropriate if the right-hand-side is a Collection or array, if the root is an Iterable or Iterator or other object whose size can't easily be determined up-front, or if the root is a nested Collection or array that will require additional unwrapping. The overall result of the expansion thus looks like the following composite: temp_arraylist = new ArrayList() for (a in temp_root) { temp_arraylist.addAll( AbstractMemberExpansionTransform.arrayToCollection( a.Bars ) ) } AbstractMemberExpansionTransformer.listToArray(temp_array)
    • createArrayListAddLoop

      private IRForEachStatement createArrayListAddLoop(IType rootType, IType rootComponentType, IType resultCompType, IRSymbol tempRoot, IRSymbol resultArrayList, IType propertyType)
    • convertListToArray

      private IRExpression convertListToArray(IType resultType, IType resultCompType, IRSymbol resultArrayList)
    • getMoreSpecificType

      private IType getMoreSpecificType(IType type1, IType type2)
    • convertToPrimitiveArray

      private IRExpression convertToPrimitiveArray(IType compType, IRExpression listToConvert)
    • listToPrimitiveArray_boolean

      public static boolean[] listToPrimitiveArray_boolean(List l)
    • listToPrimitiveArray_byte

      public static byte[] listToPrimitiveArray_byte(List l)
    • listToPrimitiveArray_char

      public static char[] listToPrimitiveArray_char(List l)
    • listToPrimitiveArray_int

      public static int[] listToPrimitiveArray_int(List l)
    • listToPrimitiveArray_short

      public static short[] listToPrimitiveArray_short(List l)
    • listToPrimitiveArray_long

      public static long[] listToPrimitiveArray_long(List l)
    • listToPrimitiveArray_float

      public static float[] listToPrimitiveArray_float(List l)
    • listToPrimitiveArray_double

      public static double[] listToPrimitiveArray_double(List l)
    • listToArray

      public static Object listToArray(List l, IType compType)
    • listToArray

      public static Object listToArray(List l, Class compType)
    • arrayToCollection

      public static Collection arrayToCollection(Object value)