01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.beans.factory.parsing;
18:
19: import org.springframework.core.io.Resource;
20:
21: /**
22: * Simple strategy allowing tools to control how source metadata is attached
23: * to the bean definition metadata.
24: *
25: * <p>Configuration parsers <strong>may</strong> provide the ability to attach
26: * source metadata during the parse phase. They will offer this metadata in a
27: * generic format which can be further modified by a {@link SourceExtractor}
28: * before being attached to the bean definition metadata.
29: *
30: * @author Rob Harrop
31: * @author Juergen Hoeller
32: * @since 2.0
33: * @see org.springframework.beans.BeanMetadataElement#getSource()
34: * @see org.springframework.beans.factory.config.BeanDefinition
35: */
36: public interface SourceExtractor {
37:
38: /**
39: * Extract the source metadata from the candidate object supplied
40: * by the configuration parser.
41: * @param sourceCandidate the original source metadata (never <code>null</code>)
42: * @param definingResource the resource that defines the given source object
43: * (may be <code>null</code>)
44: * @return the source metadata object to store (may be <code>null</code>)
45: */
46: Object extractSource(Object sourceCandidate,
47: Resource definingResource);
48:
49: }
|