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