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;
020
021import java.lang.annotation.Documented;
022import java.lang.annotation.ElementType;
023import java.lang.annotation.Retention;
024import java.lang.annotation.RetentionPolicy;
025import java.lang.annotation.Target;
026
027import javax.enterprise.util.AnnotationLiteral;
028
029import javax.inject.Qualifier;
030
031import org.microbean.development.annotation.Experimental;
032
033/**
034 * A {@link Qualifier} indicating that a relevant instance should be
035 * {@linkplain Settings#configure(Object, Iterable, String, Set)
036 * configured} immediately after being instantiated.
037 *
038 * @author <a href="https://about.me/lairdnelson"
039 * target="_parent">Laird Nelson</a>
040 *
041 * @see Settings#configure(Object, Iterable, String, Set)
042 */
043@Documented
044@Experimental
045@Qualifier
046@Retention(RetentionPolicy.RUNTIME)
047@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE })
048public @interface Configured {
049
050  /**
051   * An {@link AnnotationLiteral} that implements the {@link
052   * Configured} interface/annotation.
053   *
054   * @author <a href="https://about.me/lairdnelson"
055   * target="_parent">Laird Nelson</a>
056   *
057   * @see Configured
058   */
059  @Experimental
060  public static final class Literal extends AnnotationLiteral<Configured> implements Configured {
061
062
063    /*
064     * Static fields.
065     */
066
067
068    /**
069     * The version of this class for {@linkplain Serializable
070     * serialization purposes}.
071     */
072    private static final long serialVersionUID = 1L;
073
074    /**
075     * The sole instance of this class.
076     *
077     * @nullability This field is never {@code null}.
078     */
079    public static final Configured INSTANCE = new Literal();
080
081
082    /*
083     * Constructors.
084     */
085
086
087    /**
088     * Creates a new {@link Literal}.
089     */
090    private Literal() {
091      super();
092    }
093
094  }
095
096}