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

cz.mmsparams.api.errors.TestErrorBuilder Maven / Gradle / Ivy

The newest version!
package cz.mmsparams.api.errors;

import cz.mmsparams.api.exceptions.MmsParamsExceptionBase;
import cz.mmsparams.api.websocket.model.error.TestErrorModel;
import cz.mmsparams.api.websocket.model.error.TestErrorType;

public class TestErrorBuilder
{
    private final TestErrorModel model;

    public TestErrorBuilder()
    {
        this.model = new TestErrorModel();
    }

    public static TestErrorBuilder create()
    {
        return new TestErrorBuilder();
    }

    public TestErrorBuilder withErrorType(TestErrorType testErrorType)
    {
        model.setTestErrorType(testErrorType);
        return this;
    }

    public TestErrorBuilder withMessage(String message)
    {
        this.model.setMessage(message);
        return this;
    }

    public TestErrorBuilder withException(MmsParamsExceptionBase exception)
    {
        this.model.setException(exception);
        return this;
    }

    public TestErrorBuilder withExceptionAndMessage(MmsParamsExceptionBase exception)
    {
        this.model.setException(exception);
        return this.withMessage(exception.getMessage());
    }

    public TestErrorBuilder withAll(MmsParamsExceptionBase exception)
    {
        return this.withException(exception).withMessage(exception.getMessage()).withErrorType(exception.getTestErrorType());
    }

    public TestErrorModel build()
    {
        return this.model;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy