1 /*
2  * Copyright (C) 2023 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.adservices.cobalt;
17 
18 import androidx.annotation.NonNull;
19 
20 import com.google.cobalt.ReleaseStage;
21 
22 import java.util.Objects;
23 
24 /** Static data and functions related to Cobalt release stages. */
25 public final class CobaltReleaseStages {
26 
27     /** Parses a release stage string into a {@link ReleaseStage}. */
getReleaseStage(@onNull String releaseStage)28     static ReleaseStage getReleaseStage(@NonNull String releaseStage)
29             throws CobaltInitializationException {
30         Objects.requireNonNull(releaseStage);
31         if (releaseStage.equals("DEBUG")) {
32             return ReleaseStage.DEBUG;
33         } else if (releaseStage.equals("FISHFOOD")) {
34             return ReleaseStage.FISHFOOD;
35         } else if (releaseStage.equals("DOGFOOD")) {
36             return ReleaseStage.DOGFOOD;
37         } else if (releaseStage.equals("OPEN_BETA")) {
38             return ReleaseStage.OPEN_BETA;
39         } else if (releaseStage.equals("GA")) {
40             return ReleaseStage.GA;
41         }
42 
43         throw new CobaltInitializationException("Unknown release stage: " + releaseStage);
44     }
45 
CobaltReleaseStages()46     private CobaltReleaseStages() {
47         throw new UnsupportedOperationException("Contains only static members");
48     }
49 }
50