|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package org.apache.dubbo.spring.boot.autoconfigure; |
| 18 | + |
| 19 | +import org.apache.dubbo.common.utils.Assert; |
| 20 | +import org.springframework.core.env.PropertyResolver; |
| 21 | +import org.springframework.lang.Nullable; |
| 22 | + |
| 23 | +/** |
| 24 | + * Delegating {@link PropertyResolver} |
| 25 | + * |
| 26 | + * @since 2.7.1 |
| 27 | + */ |
| 28 | +class DelegatingPropertyResolver implements PropertyResolver { |
| 29 | + |
| 30 | + private final PropertyResolver delegate; |
| 31 | + |
| 32 | + DelegatingPropertyResolver(PropertyResolver delegate) { |
| 33 | + Assert.notNull(delegate, "The delegate of PropertyResolver must not be null"); |
| 34 | + this.delegate = delegate; |
| 35 | + } |
| 36 | + |
| 37 | + @Override |
| 38 | + public boolean containsProperty(String key) { |
| 39 | + return delegate.containsProperty(key); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + @Nullable |
| 44 | + public String getProperty(String key) { |
| 45 | + return delegate.getProperty(key); |
| 46 | + } |
| 47 | + |
| 48 | + @Override |
| 49 | + public String getProperty(String key, String defaultValue) { |
| 50 | + return delegate.getProperty(key, defaultValue); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + @Nullable |
| 55 | + public <T> T getProperty(String key, Class<T> targetType) { |
| 56 | + return delegate.getProperty(key, targetType); |
| 57 | + } |
| 58 | + |
| 59 | + @Override |
| 60 | + public <T> T getProperty(String key, Class<T> targetType, T defaultValue) { |
| 61 | + return delegate.getProperty(key, targetType, defaultValue); |
| 62 | + } |
| 63 | + |
| 64 | + @Override |
| 65 | + public String getRequiredProperty(String key) throws IllegalStateException { |
| 66 | + return delegate.getRequiredProperty(key); |
| 67 | + } |
| 68 | + |
| 69 | + @Override |
| 70 | + public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException { |
| 71 | + return delegate.getRequiredProperty(key, targetType); |
| 72 | + } |
| 73 | + |
| 74 | + @Override |
| 75 | + public String resolvePlaceholders(String text) { |
| 76 | + return delegate.resolvePlaceholders(text); |
| 77 | + } |
| 78 | + |
| 79 | + @Override |
| 80 | + public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException { |
| 81 | + return delegate.resolveRequiredPlaceholders(text); |
| 82 | + } |
| 83 | +} |
0 commit comments