/** * An internal-only constructor that provides the jobId directly, used by the copy-and-modify methods. * * @param jobId The unique identifier for this job * @param fieldValueMap The metadata about this job * * @throws IllegalArgumentException if jobId is not a key in fieldValueMap */ protected JobRow(@NotNull String jobId, Map<JobField, String> fieldValueMap) { super(fieldValueMap); if (jobId == null) { LOG.error(String.format(ErrorMessageFormat.MISSING_JOB_ID.getLoggingFormat(), fieldValueMap)); throw new IllegalArgumentException(ErrorMessageFormat.MISSING_JOB_ID.format(fieldValueMap)); } this.jobId = jobId; }
/** * Returns the Left value wrapped in this Either. * * @return The Left value wrapped in this Either * * @throws UnsupportedOperationException If this Either wraps a Right value instead */ public L getLeft() { if (!isLeft()) { LOG.error(String.format(ErrorMessageFormat.EITHER_ERROR_LEFT_OF_RIGHT.getLoggingFormat(), this)); throw new UnsupportedOperationException(ErrorMessageFormat.EITHER_ERROR_LEFT_OF_RIGHT.format(this)); } return left; }
/** * Returns the Right value wrapped in this Either. * * @return The Right value wrapped in this Either * * @throws UnsupportedOperationException If this Either wraps a Left value instead */ public R getRight() { if (isLeft()) { LOG.error(String.format(ErrorMessageFormat.EITHER_ERROR_RIGHT_OF_LEFT.getLoggingFormat(), this)); throw new UnsupportedOperationException(ErrorMessageFormat.EITHER_ERROR_RIGHT_OF_LEFT.format(this)); } return right; } }