001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright © 2020 microBean™.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
014 * implied.  See the License for the specific language governing
015 * permissions and limitations under the License.
016 */
017package org.microbean.settings;
018
019import java.io.Serializable; // for javadoc only
020
021import java.util.Collection;
022
023/**
024 * A {@link SettingsException} indicating that some {@link Value}
025 * instances were found to be ambiguous.
026 *
027 * @author <a href="https://about.me/lairdnelson"
028 * target="_parent">Laird Nelson</a>
029 */
030public class AmbiguousValuesException extends SettingsException {
031
032
033  /*
034   * Static fields.
035   */
036
037
038  /**
039   * The version of this class for {@linkplain Serializable
040   * serialization purposes}.
041   */
042  private static final long serialVersionUID = 1L;
043
044
045  /*
046   * Instance fields.
047   */
048
049
050  /**
051   * The {@link Collection} of {@link Value} instances found to be
052   * ambiguous.
053   *
054   * @nullability This field may be {@code null} at any point.
055   */
056  private final Collection<Value> values;
057
058
059  /*
060   * Constructors.
061   */
062
063
064  /**
065   * Creates a new {@link AmbiguousValuesException}.
066   *
067   * @param values the {@link Collection} of {@link Value} instances
068   * found to be ambiguous; may be {@code null}; stored by reference
069   *
070   * @see #getValues()
071   */
072  public AmbiguousValuesException(final Collection<Value> values) {
073    super();
074    this.values = values;
075  }
076
077
078  /*
079   * Instance methods.
080   */
081
082
083  /**
084   * Returns the {@link Collection} of {@link Value} instances found
085   * to be ambiguous.
086   *
087   * @return the {@link Collection} of {@link Value} instances found
088   * to be ambiguous, or {@code null}
089   *
090   * @nullability This method and its overrides may return {@code
091   * null}.
092   *
093   * @idempotency No guarantees with respect to idempotency are made
094   * about this method or its overrides.
095   */
096  public Collection<Value> getValues() {
097    return this.values;
098  }
099
100}