• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
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 package com.android.tradefed.targetprep;
17 
18 import com.android.tradefed.config.Option;
19 
20 /**
21  * Base implementation class for {@link ITargetPreparer} that allows to control whether the object
22  * is disabled or not.
23  */
24 public abstract class BaseTargetPreparer implements ITargetPreparer {
25 
26     @Option(name = "disable", description = "disables the target preparer")
27     private boolean mDisable = false;
28 
29     @Option(
30         name = "disable-tear-down",
31         description = "disables the clean up step of a target cleaner"
32     )
33     private boolean mDisableTearDown = false;
34 
35     /** {@inheritDoc} */
36     @Override
isDisabled()37     public final boolean isDisabled() {
38         return mDisable;
39     }
40 
41     /** {@inheritDoc} */
42     @Override
isTearDownDisabled()43     public final boolean isTearDownDisabled() {
44         return mDisableTearDown;
45     }
46 
47     /** {@inheritDoc} */
48     @Override
setDisable(boolean isDisabled)49     public final void setDisable(boolean isDisabled) {
50         mDisable = isDisabled;
51     }
52 
53     /** {@inheritDoc} */
54     @Override
setDisableTearDown(boolean isDisabled)55     public final void setDisableTearDown(boolean isDisabled) {
56         mDisableTearDown = isDisabled;
57     }
58 }
59