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

com.enonic.xp.dump.AbstractLoadResult Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.dump;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

abstract class AbstractLoadResult
{
    private final Long successful;

    private final List errors;

    @SuppressWarnings("unchecked")
    AbstractLoadResult( final Builder builder )
    {
        this.successful = builder.successful;
        this.errors = builder.errors;
    }

    public Long getSuccessful()
    {
        return successful;
    }

    public List getErrors()
    {
        return errors;
    }

    public static class Builder
    {
        private Long successful = 0L;

        private final List errors = new ArrayList<>();

        protected Builder()
        {
        }

        @SuppressWarnings("unchecked")
        public B successful( final Long val )
        {
            successful += val;
            return (B) this;
        }

        @SuppressWarnings("unchecked")
        public B errors( final Collection errors )
        {
            this.errors.addAll( errors );
            return (B) this;
        }

        @SuppressWarnings("unchecked")
        public B error( final LoadError error )
        {
            this.errors.add( error );
            return (B) this;
        }

        @SuppressWarnings("unchecked")
        protected T build()
        {
            return (T) this;
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy