Coverage Report - org.apache.onami.autobind.annotations.Annotations
 
Classes in this File Line Coverage Branch Coverage Complexity
Annotations
0%
0/8
N/A
1
Annotations$1
0%
0/6
N/A
1
Annotations$2
0%
0/3
N/A
1
Annotations$3
0%
0/4
N/A
1
 
 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 org.apache.onami.autobind.annotations.To.Type.INTERFACES;
 21  
 import static org.apache.onami.autobind.jsr330.Names.named;
 22  
 
 23  
 import java.lang.annotation.Annotation;
 24  
 import java.lang.reflect.Array;
 25  
 
 26  
 import javax.inject.Named;
 27  
 
 28  
 import org.apache.onami.autobind.annotations.To.Type;
 29  
 
 30  
 public class Annotations
 31  
 {
 32  
 
 33  
     /**
 34  
      * Hidden constructor, this class cannot be instantiated.
 35  
      */
 36  
     protected Annotations()
 37  0
     {
 38  
         // do nothing
 39  0
     }
 40  
 
 41  
     public static Bind createBind()
 42  
     {
 43  0
         return createBind( INTERFACES );
 44  
     }
 45  
 
 46  
     public static Bind createBind( final Type type )
 47  
     {
 48  0
         return new Bind()
 49  0
         {
 50  
 
 51  
             @Override
 52  
             public Class<? extends Annotation> annotationType()
 53  
             {
 54  0
                 return Bind.class;
 55  
             }
 56  
 
 57  
             @Override
 58  
             public Named value()
 59  
             {
 60  0
                 return named( "" );
 61  
             }
 62  
 
 63  
             @Override
 64  
             public AnnotatedWith annotatedWith() {
 65  0
                 return null;
 66  
             }
 67  
 
 68  
             @Override
 69  
             public To to()
 70  
             {
 71  0
                 return createTo( type );
 72  
             }
 73  
 
 74  
             @Override
 75  
             public boolean multiple()
 76  
             {
 77  0
                 return false;
 78  
             }
 79  
 
 80  
         };
 81  
     }
 82  
 
 83  
     @SuppressWarnings("unchecked")
 84  
     public static AnnotatedWith createAnnotatedWith( )
 85  
     {
 86  0
         return createAnnotatedWith( (Class<? super Annotation>[]) Array.newInstance(Annotation.class, 0) );
 87  
     }
 88  
 
 89  
     public static AnnotatedWith createAnnotatedWith( final Class<? super Annotation>... annotations )
 90  
     {
 91  0
         return new AnnotatedWith()
 92  0
         {
 93  
 
 94  
             @Override
 95  
             public Class<? extends Annotation> annotationType()
 96  
             {
 97  0
                 return AnnotatedWith.class;
 98  
             }
 99  
 
 100  
             @Override
 101  
             public Class<? super Annotation>[] value()
 102  
             {
 103  0
                 return annotations;
 104  
             }
 105  
 
 106  
         };
 107  
     }
 108  
 
 109  
     public static To createTo()
 110  
     {
 111  0
         return createTo( INTERFACES );
 112  
     }
 113  
 
 114  
     public static To createTo( final Type type )
 115  
     {
 116  0
         return new To()
 117  0
         {
 118  
 
 119  
             @Override
 120  
             public Class<? extends Annotation> annotationType()
 121  
             {
 122  0
                 return To.class;
 123  
             }
 124  
 
 125  
             @Override
 126  
             public Type value()
 127  
             {
 128  0
                 return type;
 129  
             }
 130  
 
 131  
             @Override
 132  
             public Class<? extends Object>[] customs()
 133  
             {
 134  0
                 return new Class<?>[0];
 135  
             }
 136  
 
 137  
         };
 138  
     }
 139  
 
 140  
 }