JesLimitReachedException.java

// Generated by delombok at Mon Apr 14 16:48:01 UTC 2025
package de.larssh.jes;

import static java.util.Collections.unmodifiableList;
import java.util.List;
import org.apache.commons.net.ftp.FTPClient;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * Thrown to indicate that a JES limit has been reached and contains the job
 * entries up to the specified JES limit.
 */
public class JesLimitReachedException extends JesException {
	/**
	 * Limit of spool entries
	 */
	private final int limit;
	/**
	 * List of jobs up to the JES limit
	 */
	private final transient List<Job> jobs;

	/**
	 * Constructs a new {@link JesLimitReachedException} with a default detail
	 * message and a given list of jobs up to the limit of spool entries.
	 *
	 * @param limit     limit of spool entries
	 * @param jobs      list of jobs up to the limit
	 * @param ftpClient FTP client with reply string
	 */
	@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "Mutability of jobs.outputs is not expected to be a problem for this exception")
	public JesLimitReachedException(final int limit, final List<Job> jobs, final FTPClient ftpClient) {
		super(ftpClient, "Listing limit of %d reached.", limit);
		this.limit = limit;
		this.jobs = jobs;
	}

	/**
	 * List of jobs up to the limit
	 *
	 * @return list of jobs
	 */
	public List<Job> getJobs() {
		return unmodifiableList(jobs);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("PMD.UselessOverridingMethod")
	public String getMessage() {
		return super.getMessage();
	}

	/**
	 * Limit of spool entries
	 *
	 * @return limit of spool entries
	 */
	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	public int getLimit() {
		return this.limit;
	}

	@edu.umd.cs.findbugs.annotations.NonNull
	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	public java.lang.String toString() {
		return "JesLimitReachedException(message=" + this.getMessage() + ", limit=" + this.getLimit() + ", jobs=" + this.getJobs() + ")";
	}

	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	public boolean equals(@edu.umd.cs.findbugs.annotations.Nullable final java.lang.Object o) {
		if (o == this) return true;
		if (!(o instanceof JesLimitReachedException)) return false;
		final JesLimitReachedException other = (JesLimitReachedException) o;
		if (!other.canEqual((java.lang.Object) this)) return false;
		if (!super.equals(o)) return false;
		if (this.getLimit() != other.getLimit()) return false;
		return true;
	}

	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	protected boolean canEqual(@edu.umd.cs.findbugs.annotations.Nullable final java.lang.Object other) {
		return other instanceof JesLimitReachedException;
	}

	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	public int hashCode() {
		final int PRIME = 59;
		int result = super.hashCode();
		result = result * PRIME + this.getLimit();
		return result;
	}
}