001/* 002 * Copyright 2002-2012 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.beans.factory.parsing; 018 019import org.springframework.core.io.Resource; 020 021/** 022 * Simple {@link SourceExtractor} implementation that just passes 023 * the candidate source metadata object through for attachment. 024 * 025 * <p>Using this implementation means that tools will get raw access to the 026 * underlying configuration source metadata provided by the tool. 027 * 028 * <p>This implementation <strong>should not</strong> be used in a production 029 * application since it is likely to keep too much metadata in memory 030 * (unnecessarily). 031 * 032 * @author Rob Harrop 033 * @since 2.0 034 */ 035public class PassThroughSourceExtractor implements SourceExtractor { 036 037 /** 038 * Simply returns the supplied {@code sourceCandidate} as-is. 039 * @param sourceCandidate the source metadata 040 * @return the supplied {@code sourceCandidate} 041 */ 042 @Override 043 public Object extractSource(Object sourceCandidate, Resource definingResource) { 044 return sourceCandidate; 045 } 046 047}