001/* 002 * Copyright 2012-2018 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.context.properties.bind; 018 019import org.springframework.boot.context.properties.source.ConfigurationProperty; 020import org.springframework.boot.context.properties.source.ConfigurationPropertySource; 021 022/** 023 * Context information for use by {@link BindHandler BindHandlers}. 024 * 025 * @author Phillip Webb 026 * @author Madhura Bhave 027 * @since 2.0.0 028 */ 029public interface BindContext { 030 031 /** 032 * Return the source binder that is performing the bind operation. 033 * @return the source binder 034 */ 035 Binder getBinder(); 036 037 /** 038 * Return the current depth of the binding. Root binding starts with a depth of 039 * {@code 0}. Each subsequent property binding increases the depth by {@code 1}. 040 * @return the depth of the current binding 041 */ 042 int getDepth(); 043 044 /** 045 * Return an {@link Iterable} of the {@link ConfigurationPropertySource sources} being 046 * used by the {@link Binder}. 047 * @return the sources 048 */ 049 Iterable<ConfigurationPropertySource> getSources(); 050 051 /** 052 * Return the {@link ConfigurationProperty} actually being bound or {@code null} if 053 * the property has not yet been determined. 054 * @return the configuration property (may be {@code null}). 055 */ 056 ConfigurationProperty getConfigurationProperty(); 057 058}