1 /* 2 * Copyright (C) 2019 The Dagger Authors. 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 dagger.internal.codegen.binding; 18 19 import static com.google.common.base.CaseFormat.UPPER_CAMEL; 20 import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; 21 22 import com.google.common.base.Ascii; 23 24 /** Enumeration of the different kinds of component creators. */ 25 public enum ComponentCreatorKind { 26 /** {@code @Component.Builder} or one of its subcomponent/production variants. */ 27 BUILDER, 28 29 /** {@code @Component.Factory} or one of its subcomponent/production variants. */ 30 FACTORY, 31 ; 32 33 /** Name to use as (or as part of) a type name for a creator of this kind. */ typeName()34 public String typeName() { 35 return UPPER_UNDERSCORE.to(UPPER_CAMEL, name()); 36 } 37 38 /** Name to use for a component's static method returning a creator of this kind. */ methodName()39 public String methodName() { 40 return Ascii.toLowerCase(name()); 41 } 42 } 43