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 abstract class Engine { 25 26 protected boolean publicNoArgsConstructorInjected; 27 protected boolean subPackagePrivateMethodInjected; 28 protected boolean superPackagePrivateMethodInjected; 29 protected boolean subPackagePrivateMethodForOverrideInjected; 30 protected boolean superPackagePrivateMethodForOverrideInjected; 31 32 protected boolean overriddenTwiceWithOmissionInMiddleInjected; 33 protected boolean overriddenTwiceWithOmissionInSubclassInjected; 34 35 protected Seat seatA; 36 protected Seat seatB; 37 protected Tire tireA; 38 protected Tire tireB; 39 40 public boolean overriddenPackagePrivateMethodInjectedTwice; 41 public boolean qualifiersInheritedFromOverriddenMethod; 42 injectPackagePrivateMethod()43 @Inject void injectPackagePrivateMethod() { 44 superPackagePrivateMethodInjected = true; 45 } 46 injectPackagePrivateMethodForOverride()47 @Inject void injectPackagePrivateMethodForOverride() { 48 superPackagePrivateMethodForOverrideInjected = true; 49 } 50 injectQualifiers(@rivers Seat seatA, Seat seatB, @Named("spare") Tire tireA, Tire tireB)51 @Inject public void injectQualifiers(@Drivers Seat seatA, Seat seatB, 52 @Named("spare") Tire tireA, Tire tireB) { 53 if (!(seatA instanceof DriversSeat) 54 || (seatB instanceof DriversSeat) 55 || !(tireA instanceof SpareTire) 56 || (tireB instanceof SpareTire)) { 57 qualifiersInheritedFromOverriddenMethod = true; 58 } 59 } 60 injectTwiceOverriddenWithOmissionInMiddle()61 @Inject public void injectTwiceOverriddenWithOmissionInMiddle() { 62 overriddenTwiceWithOmissionInMiddleInjected = true; 63 } 64 injectTwiceOverriddenWithOmissionInSubclass()65 @Inject public void injectTwiceOverriddenWithOmissionInSubclass() { 66 overriddenTwiceWithOmissionInSubclassInjected = true; 67 } 68 } 69