Home | History | Annotate | Download | only in auto
      1 /*
      2  * Copyright (C) 2009 The JSR-330 Expert Group
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     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.atinject.tck.auto;
     18 
     19 import org.atinject.tck.auto.accessories.SpareTire;
     20 
     21 import javax.inject.Inject;
     22 import javax.inject.Named;
     23 
     24 public class V8Engine extends GasEngine {
     25 
     26     public V8Engine() {
     27         publicNoArgsConstructorInjected = true;
     28     }
     29 
     30     @Inject void injectPackagePrivateMethod() {
     31         if (subPackagePrivateMethodInjected) {
     32             overriddenPackagePrivateMethodInjectedTwice = true;
     33         }
     34         subPackagePrivateMethodInjected = true;
     35     }
     36 
     37     /**
     38      * Qualifiers are swapped from how they appear in the superclass.
     39      */
     40     public void injectQualifiers(Seat seatA, @Drivers Seat seatB,
     41             Tire tireA, @Named("spare") Tire tireB) {
     42         if ((seatA instanceof DriversSeat)
     43                 || !(seatB instanceof DriversSeat)
     44                 || (tireA instanceof SpareTire)
     45                 || !(tireB instanceof SpareTire)) {
     46             qualifiersInheritedFromOverriddenMethod = true;
     47         }
     48     }
     49 
     50     void injectPackagePrivateMethodForOverride() {
     51         subPackagePrivateMethodForOverrideInjected = true;
     52     }
     53 
     54     @Inject public void injectTwiceOverriddenWithOmissionInMiddle() {
     55         overriddenTwiceWithOmissionInMiddleInjected = true;
     56     }
     57 
     58     public void injectTwiceOverriddenWithOmissionInSubclass() {
     59         overriddenTwiceWithOmissionInSubclassInjected = true;
     60     }
     61 }
     62