public DiffBuilder append()

in flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/diff/DiffBuilder.java [72:120]


    public DiffBuilder<T> append(
            @NonNull final String fieldName, final Object left, final Object right, DiffType type) {

        if (triviallyEqual) {
            return this;
        }
        if (left == right) {
            return this;
        }

        final Object objectToTest = Objects.requireNonNullElse(left, right);

        if (objectToTest.getClass().isArray()) {
            if (objectToTest instanceof boolean[]) {
                return append(fieldName, (boolean[]) left, (boolean[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof byte[]) {
                return append(fieldName, (byte[]) left, (byte[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof char[]) {
                return append(fieldName, (char[]) left, (char[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof double[]) {
                return append(fieldName, (double[]) left, (double[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof float[]) {
                return append(fieldName, (float[]) left, (float[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof int[]) {
                return append(fieldName, (int[]) left, (int[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof long[]) {
                return append(fieldName, (long[]) left, (long[]) right, Arrays::equals, type);
            }
            if (objectToTest instanceof short[]) {
                return append(fieldName, (short[]) left, (short[]) right, Arrays::equals, type);
            }

            return append(fieldName, (Object[]) left, (Object[]) right, Arrays::equals, type);
        }

        if (left != null && left.equals(right)) {
            return this;
        }

        diffs.add(new Diff<>(fieldName, left, right, type));

        return this;
    }