/** * Return only the package, or empty string if none. */ public static String getPackageName(String fullName) { if (fullName == null) { return null; } if (fullName.isEmpty()) { return fullName; } int dims = getArrayDimensions(fullName); if (dims > 0) { if (fullName.length() == dims + 1) { // don't care, it's a primitive return ""; } else { fullName = fullName.substring(dims + 1); } } int lastDot = fullName.lastIndexOf('.'); return lastDot > -1 ? fullName.substring(0, lastDot) : ""; } }
/** * Return only the package, or empty string if none. */ public static String getPackageName(String fullName) { if (fullName == null) { return null; } if (fullName.isEmpty()) { return fullName; } int dims = getArrayDimensions(fullName); if (dims > 0) { if (fullName.length() == dims + 1) { // don't care, it's a primitive return ""; } else { fullName = fullName.substring(dims + 1); } } int lastDot = fullName.lastIndexOf('.'); return lastDot > -1 ? fullName.substring(0, lastDot) : ""; } }
int dims = getArrayDimensions(fullName); if (dims > 0) { if (fullName.length() == dims + 1) {
int dims = getArrayDimensions(fullName); if (dims > 0) { if (fullName.length() == dims + 1) {