01: /*
02: * Copyright 2006-2007, Unitils.org
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: package org.unitils.inject.annotation;
17:
18: import static java.lang.annotation.ElementType.FIELD;
19: import java.lang.annotation.Retention;
20: import static java.lang.annotation.RetentionPolicy.RUNTIME;
21: import java.lang.annotation.Target;
22:
23: /**
24: * Annotation indicating that the the {@link org.unitils.inject.InjectModule} should try to inject the object assigned to
25: * the annotated field to the object defined by the target attribute (or the object(s) assigned to the field annotated
26: * with {@link TestedObject}.
27: * <p/>
28: * Explicit injection is used, which means that the object is injected to the property indicated by the {@link #property()}
29: * attribute.
30: *
31: * @author Filip Neven
32: * @author Tim Ducheyne
33: */
34: @Target(FIELD)
35: @Retention(RUNTIME)
36: public @interface InjectInto {
37:
38: /**
39: * The name of the field that references the object to which the object in the annotated field should be injected.
40: * If not specified, the target is defined by the field annotated with {@link TestedObject}
41: *
42: * @return the target field, null for tested object
43: */
44: String target() default "";
45:
46: /**
47: * OGNL expression that defines the property to which the object referenced by the annotated field is injected
48: *
49: * @return the ognl expression, not null
50: */
51: String property();
52:
53: }
|