1 /* 2 * Copyright (C) 2009 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 17 package signature.model.impl; 18 19 import signature.model.IPrimitiveType; 20 21 public enum SigPrimitiveType implements IPrimitiveType { 22 VOID_TYPE("void"), BOOLEAN_TYPE("boolean"), BYTE_TYPE("byte"), CHAR_TYPE( 23 "char"), SHORT_TYPE("short"), INT_TYPE("int"), LONG_TYPE("long"), 24 FLOAT_TYPE("float"), DOUBLE_TYPE("double"); 25 26 private String name; 27 SigPrimitiveType(String name)28 private SigPrimitiveType(String name) { 29 this.name = name; 30 } 31 valueOfTypeName(String name)32 public static SigPrimitiveType valueOfTypeName(String name) { 33 for (SigPrimitiveType primitive : values()) { 34 if (primitive.name.equals(name)) { 35 return primitive; 36 } 37 } 38 throw new IllegalArgumentException(name + " is not a primitive type"); 39 } 40 getName()41 public String getName() { 42 return name; 43 } 44 45 @Override toString()46 public String toString() { 47 return name; 48 } 49 } 50