001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright © 2017 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.configuration.spi;
018
019import java.util.Set;
020
021import org.microbean.configuration.Configurations;
022
023/**
024 * A skeletal implementation of the {@link Configuration} interface.
025 *
026 * @author <a href="https://about.me/lairdnelson"
027 * target="_parent">Laird Nelson</a>
028 */
029public abstract class AbstractConfiguration implements Configuration {
030
031
032  /*
033   * Instance fields.
034   */
035
036
037  /**
038   * The {@link Configurations} governing this {@link Configuration}.
039   *
040   * <p>This field may be {@code null}.</p>
041   *
042   * @see #getConfigurations()
043   *
044   * @see #setConfigurations(Configurations)
045   */
046  private Configurations configurations;
047
048
049  /*
050   * Constructors.
051   */
052  
053
054  /**
055   * Creates a new {@link AbstractConfiguration}.
056   */
057  protected AbstractConfiguration() {
058    super();
059  }
060
061
062  /*
063   * Instance methods.
064   */
065  
066
067  /**
068   * Installs the supplied {@link Configurations} on this {@link
069   * AbstractConfiguration} implementation.
070   *
071   * @param configurations the {@link Configurations} to install; may
072   * be {@code null}
073   *
074   * @see #getConfigurations()
075   */
076  @Override
077  public void setConfigurations(final Configurations configurations) {
078    this.configurations = configurations;
079  }
080
081  /**
082   * Returns the {@link Configurations} installed on this {@link
083   * AbstractConfiguration} implementation.
084   *
085   * <p>This method may return {@code null}.</p>
086   *
087   * @return the {@link Configurations} installed on this {@link
088   * AbstractConfiguration} implementation, or {@code null}
089   *
090   * @see #setConfigurations(Configurations)
091   */
092  public Configurations getConfigurations() {
093    return this.configurations;
094  }
095
096}