- abstract ArrayList<Method> getterMethods();
-
- private static Implementation codecEquals(final ImmutableMap<StackManipulation, Method> properties) {
- // Label for 'return false;'
- final Label falseLabel = new Label();
- // Condition for 'if (!...)'
- final StackManipulation ifFalse = ByteBuddyUtils.ifEq(falseLabel);
-
- final List<StackManipulation> manipulations = new ArrayList<>(properties.size() * 6 + 5);
- for (Entry<StackManipulation, Method> entry : properties.entrySet()) {
- // if (!java.util.(Objects|Arrays).equals(getFoo(), other.getFoo())) {
- // return false;
- // }
- manipulations.add(THIS);
- manipulations.add(entry.getKey());
- manipulations.add(FIRST_ARG_REF);
- manipulations.add(entry.getKey());
- manipulations.add(entry.getValue().getReturnType().isArray() ? ARRAYS_EQUALS : OBJECTS_EQUALS);
- manipulations.add(ifFalse);
- }
-
- // return true;
- manipulations.add(IntegerConstant.ONE);
- manipulations.add(MethodReturn.INTEGER);
- // L0: return false;
- manipulations.add(ByteBuddyUtils.markLabel(falseLabel));
- manipulations.add(IntegerConstant.ZERO);
- manipulations.add(MethodReturn.INTEGER);
-
- return new Implementation.Simple(manipulations.toArray(new StackManipulation[0]));
- }
-