View Javadoc

1   package org.apache.onami.autobind.annotations;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *  http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  import static java.lang.annotation.ElementType.TYPE;
21  import static java.lang.annotation.RetentionPolicy.RUNTIME;
22  
23  import java.lang.annotation.Retention;
24  import java.lang.annotation.Target;
25  
26  import javax.inject.Named;
27  import javax.inject.Qualifier;
28  
29  /**
30   * Annotate a Class which should be bound automatically. The Classpath Scanner,
31   * will check for these classes. If the name()-Attribute is set (default is ""),
32   * the class will be bound to the implemented interfaces and a named annotation.
33   *
34   * You can overwrite the interfaces, which should be used for binding the class.
35   * If bind()-Attribute is not set, the implemented interfaces will be used. If
36   * set they will be ignored and overwritten.
37   *
38   * If you annotate your class with {@link com.google.inject.Singleton} or
39   * {@link javax.inject.Singleton} they will be also bound to the
40   * Singleton-Scope.
41   */
42  @Qualifier
43  @GuiceAnnotation
44  @Retention( RUNTIME )
45  @Target( { TYPE } )
46  public @interface Bind
47  {
48  
49      Named value() default @Named( "" );
50  
51      boolean multiple() default false;
52  
53      AnnotatedWith annotatedWith() default @AnnotatedWith();
54  
55      To to() default @To( );
56  
57  }