SplitLimit.java

// Generated by delombok at Mon Nov 18 07:27:48 UTC 2024
package de.larssh.utils.text;

import static de.larssh.utils.Finals.constant;

/**
 * {@link String#split(String)} and
 * {@link java.util.regex.Pattern#split(CharSequence)} should not be used as
 * trailing empty strings are discarded. That might be confusing.
 *
 * <p>
 * Use {@link java.util.regex.Pattern#split(CharSequence, int)} instead and
 * think about the {@code limit} parameter. Use {@link #NO_LIMIT} to not strip
 * empty trailing strings.
 */
@SuppressWarnings("PMD.ClassNamingConventions")
public final class SplitLimit {
	/**
	 * No limit. Empty trailing strings are kept.
	 *
	 * <p>
	 * This value is meant to be used by either
	 * {@link java.util.regex.Pattern#split(CharSequence, int)} or
	 * {@link String#split(String, int)}.
	 */
	public static final int NO_LIMIT = constant(-1);
	/**
	 * No limit and strip empty trailing strings.
	 *
	 * <p>
	 * This value is meant to be used by either
	 * {@link java.util.regex.Pattern#split(CharSequence, int)} or
	 * {@link String#split(String, int)}.
	 */
	public static final int NO_LIMIT_AND_STRIP_EMPTY_TRAILING = constant(0);

	@java.lang.SuppressWarnings("all")
	@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code")
	@lombok.Generated
	private SplitLimit() {
		throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated");
	}
}