325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A * Utility methods that convert arbitrary strings into Java identifiers. 325N/A * Checks if a given string is usable as a Java identifier. 325N/A * Checks if the given string is a valid fully qualified name. 325N/A * Checks if the given string is a valid Java package name. 325N/A * <b>Experimental API:</b> converts an English word into a plural form. 325N/A * a word, such as "child", "apple". Must not be null. 325N/A * It accepts word concatanation forms 325N/A * that are common in programming languages, such as "my_child", "MyChild", 325N/A * "myChild", "MY-CHILD", "CODE003-child", etc, and mostly tries to do the right thing. 325N/A * ("my_children","MyChildren","myChildren", and "MY-CHILDREN", "CODE003-children" respectively) 325N/A * Although this method only works for English words, it handles non-English 325N/A * words gracefully (by just returning it as-is.) For example, 日本語 325N/A * will be returned as-is without modified, not "日本語s" 325N/A * This method doesn't handle suffixes very well. For example, passing 325N/A * "person56" will return "person56s", not "people56". 325N/A // remember the casing of the word 325N/A // check if the word looks like an English word. 325N/A // if we see non-ASCII characters, abort 325N/A // note that this isn't the same as allUpper &= Character.isUpperCase(ch); 325N/A /** All reserved keywords of Java. */ 325N/A // technically these are not reserved words but they cannot be used as identifiers. 325N/A // and I believe assert is also a new keyword 325N/A "(.*)child",
"$1children",