001/* 002 * Copyright 2002-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 * https://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.core; 018 019import org.springframework.lang.Nullable; 020 021/** 022 * Any object can implement this interface to provide its actual {@link ResolvableType}. 023 * 024 * <p>Such information is very useful when figuring out if the instance matches a generic 025 * signature as Java does not convey the signature at runtime. 026 * 027 * <p>Users of this interface should be careful in complex hierarchy scenarios, especially 028 * when the generic type signature of the class changes in sub-classes. It is always 029 * possible to return {@code null} to fallback on a default behavior. 030 * 031 * @author Stephane Nicoll 032 * @since 4.2 033 */ 034public interface ResolvableTypeProvider { 035 036 /** 037 * Return the {@link ResolvableType} describing this instance 038 * (or {@code null} if some sort of default should be applied instead). 039 */ 040 @Nullable 041 ResolvableType getResolvableType(); 042 043}