001/*
002 * Copyright 2012-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.configurationmetadata;
018
019import java.util.ArrayList;
020import java.util.List;
021
022/**
023 * Hints of an item to provide the list of values and/or the name of the provider
024 * responsible to identify suitable values. If the type of the related item is a
025 * {@link java.util.Map} it can have both key and value hints.
026 *
027 * @author Stephane Nicoll
028 * @since 1.4.0
029 */
030public class Hints {
031
032        private final List<ValueHint> keyHints = new ArrayList<>();
033
034        private final List<ValueProvider> keyProviders = new ArrayList<>();
035
036        private final List<ValueHint> valueHints = new ArrayList<>();
037
038        private final List<ValueProvider> valueProviders = new ArrayList<>();
039
040        /**
041         * The list of well-defined keys, if any. Only applicable if the type of the related
042         * item is a {@link java.util.Map}. If no extra {@link ValueProvider provider} is
043         * specified, these values are to be considered a closed-set of the available keys for
044         * the map.
045         * @return the key hints
046         */
047        public List<ValueHint> getKeyHints() {
048                return this.keyHints;
049        }
050
051        /**
052         * The value providers that are applicable to the keys of this item. Only applicable
053         * if the type of the related item is a {@link java.util.Map}. Only one
054         * {@link ValueProvider} is enabled for a key: the first in the list that is supported
055         * should be used.
056         * @return the key providers
057         */
058        public List<ValueProvider> getKeyProviders() {
059                return this.keyProviders;
060        }
061
062        /**
063         * The list of well-defined values, if any. If no extra {@link ValueProvider provider}
064         * is specified, these values are to be considered a closed-set of the available
065         * values for this item.
066         * @return the value hints
067         */
068        public List<ValueHint> getValueHints() {
069                return this.valueHints;
070        }
071
072        /**
073         * The value providers that are applicable to this item. Only one
074         * {@link ValueProvider} is enabled for an item: the first in the list that is
075         * supported should be used.
076         * @return the value providers
077         */
078        public List<ValueProvider> getValueProviders() {
079                return this.valueProviders;
080        }
081
082}