Package org.apache.flink.table.codesplit
Class MemberFieldRewriter
- java.lang.Object
-
- org.apache.flink.table.codesplit.MemberFieldRewriter
-
- All Implemented Interfaces:
CodeRewriter
@Internal public class MemberFieldRewriter extends Object implements CodeRewriter
Group member variables with the same type into arrays to reduce the number of members.Before
public class Example { int a; long b; int c = 1; long d = 2; public void myFun() { System.out.println(a + b + c + d); } }
After
public class Example { int[] rewrite$0 = new int[2]; long[] rewrite$1 = new long[2]; { rewrite$0[1] = 1; rewrite$1[1] = 2; } public void myFun() { System.out.println(rewrite$0[0] + rewrite$1[0] + rewrite$0[1] + rewrite$1[1]); } }
-
-
Constructor Summary
Constructors Constructor Description MemberFieldRewriter(String code, int maxFieldCount)
-
-
-
Constructor Detail
-
MemberFieldRewriter
public MemberFieldRewriter(String code, int maxFieldCount)
-
-
Method Detail
-
rewrite
public String rewrite()
- Specified by:
rewrite
in interfaceCodeRewriter
-
-