PrimitiveTypeDesc.java revision 3170:dc017a37aac5
1169689Skan/* 2169689Skan * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 3169689Skan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4169689Skan * 5169689Skan * This code is free software; you can redistribute it and/or modify it 6169689Skan * under the terms of the GNU General Public License version 2 only, as 7169689Skan * published by the Free Software Foundation. Oracle designates this 8169689Skan * particular file as subject to the "Classpath" exception as provided 9169689Skan * by Oracle in the LICENSE file that accompanied this code. 10169689Skan * 11169689Skan * This code is distributed in the hope that it will be useful, but WITHOUT 12169689Skan * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13169689Skan * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14169689Skan * version 2 for more details (a copy is included in the LICENSE file that 15169689Skan * accompanied this code). 16169689Skan * 17169689Skan * You should have received a copy of the GNU General Public License version 18169689Skan * 2 along with this work; if not, write to the Free Software Foundation, 19169689Skan * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20169689Skan * 21169689Skan * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22169689Skan * or visit www.oracle.com if you need additional information or have any 23169689Skan * questions. 24169689Skan */ 25169689Skan 26169689Skanpackage com.sun.tools.sjavac.pubapi; 27169689Skan 28169689Skanimport java.io.Serializable; 29169689Skan 30169689Skanimport javax.lang.model.type.TypeKind; 31169689Skan 32169689Skanimport com.sun.tools.javac.util.StringUtils; 33169689Skan 34169689Skanpublic class PrimitiveTypeDesc extends TypeDesc implements Serializable { 35169689Skan 36169689Skan private static final long serialVersionUID = 6051065543149129106L; 37169689Skan 38169689Skan public PrimitiveTypeDesc(TypeKind typeKind) { 39169689Skan super(typeKind); 40169689Skan if (!typeKind.isPrimitive() && typeKind != TypeKind.VOID) 41169689Skan throw new IllegalArgumentException("Only primitives or void accepted"); 42169689Skan } 43169689Skan 44169689Skan // This class has no fields, so the inherited hashCode and equals should do fine. 45169689Skan 46169689Skan @Override 47169689Skan public String toString() { 48169689Skan return StringUtils.toLowerCase(typeKind.toString()); 49169689Skan } 50169689Skan} 51169689Skan