All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.ast.mutation.BatchSaveResult Maven / Gradle / Ivy

The newest version!
package org.babyfish.jimmer.sql.ast.mutation;

import org.jetbrains.annotations.NotNull;

import java.util.*;

public class BatchSaveResult extends AbstractMutationResult {

    private List> items;

    public BatchSaveResult(
            Map affectedRowMap,
            List> items
    ) {
        super(affectedRowMap);
        this.items = Collections.unmodifiableList(items);
    }

    public List> getItems() {
        return items;
    }

    @Override
    public int hashCode() {
        return Objects.hash(affectedRowCountMap, items);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BatchSaveResult that = (BatchSaveResult) o;
        return affectedRowCountMap.equals(that.affectedRowCountMap) &&
                items.equals(that.items);
    }

    @Override
    public String toString() {
        return "BatchSaveResult{" +
                "totalAffectedRowCount=" + totalAffectedRowCount +
                ", affectedRowCountMap=" + affectedRowCountMap +
                ", simpleResults=" + items +
                '}';
    }

    public static class Item implements MutationResultItem {

        private final E originalEntity;

        private final E modifiedEntity;

        public Item(E originalEntity, E modifiedEntity) {
            this.originalEntity = originalEntity;
            this.modifiedEntity = modifiedEntity;
        }

        @NotNull
        @Override
        public E getOriginalEntity() {
            return originalEntity;
        }

        @NotNull
        @Override
        public E getModifiedEntity() {
            return modifiedEntity;
        }

        @Override
        public String toString() {
            return "Item{" +
                    "originalEntity=" + originalEntity +
                    ", modifiedEntity=" + modifiedEntity +
                    '}';
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy