Constants.java revision 553
553N/A * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 553N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 553N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 553N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Utility class for operating on constant expressions. 0N/A * Converts a constant in javac's internal representation (in which 0N/A * boolean, char, byte, short, and int are each represented by an Integer) 0N/A * into standard representation. Other values (including null) are 0N/A * returned unchanged. 0N/A * Returns a formatter for generating the text of constant 0N/A * expressions. Equivalent to 0N/A * <tt>getFormatter(new StringBuilder())</tt>. 0N/A * Returns a formatter for generating the text of constant 0N/A * expressions. Also generates the text of constant 0N/A * "pseudo-expressions" for annotations and array-valued 0N/A * annotation elements. 0N/A * @param buf where the expression is written 0N/A * Utility class used to generate the text of constant 0N/A * expressions. Also generates the text of constant 0N/A * "pseudo-expressions" for annotations and array-valued 0N/A * annotation elements. 0N/A * Appends a constant whose type is not statically known 0N/A * by dispatching to the appropriate overloaded append method. 0N/A * Appends a string, escaped (as needed) and quoted. 0N/A * Appends a Character, escaped (as needed) and quoted. 0N/A * Appends the class literal corresponding to a type. Should 0N/A * only be invoked for types that have an associated literal. 0N/A * e.g: "java.lang.String.class" 0N/A * Appends the fully qualified name of an enum constant. 0N/A * e.g: "java.math.RoundingMode.UP" 0N/A * Appends the text of an annotation pseudo-expression. 0N/A * e.g: "@pkg.Format(linesep='\n')" 0N/A * Appends the elements of a collection, enclosed within braces 0N/A * and separated by ", ". Useful for array-valued annotation 0N/A * For each char of a string, append using appendUnquoted(char). 0N/A * Appends a char (unquoted), using escapes for those that are not 0N/A * printable ASCII. We don't know what is actually printable in 0N/A * the locale in which this result will be used, so ASCII is our 0N/A * best guess as to the least common denominator. 0N/A * Is c a printable ASCII character? 0N/A return c >=
' ' && c <=
'~';