private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return false; } if (packageName(typeName).length() == 0) { return false; } Set packages = (Set)typeNameMap.get(shortName(typeName)); return (packages == null) || (packages.size() <= 1); }
private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return false; } if (packageName(typeName).length() == 0) { return false; } Set packages = (Set)typeNameMap.get(shortName(typeName)); return (packages == null) || (packages.size() <= 1); }
private static boolean adjustmentNeededForType(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return false; } if (packageName(typeName).length() == 0) { return false; } Set packages = (Set)typeNameMap.get(shortName(typeName)); return (packages == null) || (packages.size() <= 1); }
/** * Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports() */ protected static void putTypeNameInMap(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return; } String shortName = shortName(typeName); String packageName = packageName(typeName); if (packageName.length() > 0) { Set packageNames; if (typeNameMap.get(shortName) == null) { packageNames = new HashSet(); typeNameMap.put(shortName, packageNames); } else { packageNames = (Set)typeNameMap.get(shortName); } // There is no package name. The package is the default package. // Do nothing, as neither an import is needed, nor does the class need to be unqualified. if (!packageNames.contains(packageName)) { packageNames.add(packageName); } } }
/** * Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports() */ protected static void putTypeNameInMap(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return; } String shortName = shortName(typeName); String packageName = packageName(typeName); if (packageName.length() > 0) { Set packageNames; if (typeNameMap.get(shortName) == null) { packageNames = new HashSet(); typeNameMap.put(shortName, packageNames); } else { packageNames = (Set)typeNameMap.get(shortName); } // There is no package name. The package is the default package. // Do nothing, as neither an import is needed, nor does the class need to be unqualified. if (!packageNames.contains(packageName)) { packageNames.add(packageName); } } }
/** * Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports() */ protected static void putTypeNameInMap(String typeName, Map typeNameMap) { if ((typeName == null) || typeName.equals("")) { return; } String shortName = shortName(typeName); String packageName = packageName(typeName); if (packageName.length() > 0) { Set packageNames; if (typeNameMap.get(shortName) == null) { packageNames = new HashSet(); typeNameMap.put(shortName, packageNames); } else { packageNames = (Set)typeNameMap.get(shortName); } // There is no package name. The package is the default package. // Do nothing, as neither an import is needed, nor does the class need to be unqualified. if (!packageNames.contains(packageName)) { packageNames.add(packageName); } } }
/** * Compares the typeName to those stored in the typeNameMap. * If the short name of the typeName is unambiguous (only one package for * that short name in the Map), removes the package name and returns the * short name, else returns the whole thing. * * Assumes that typeName contains only a package name (optional) and a short name, * potentially with subtended brackets. * * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.) */ protected static String adjustTypeName(String typeName, Map typeNameMap) { if (adjustmentNeededForType(typeName, typeNameMap)) { putTypeNameInMap(typeName, typeNameMap); return typeName.substring(packageName(typeName).length() + 1); } else { return typeName; } }
/** * Compares the typeName to those stored in the typeNameMap. * If the short name of the typeName is unambiguous (only one package for * that short name in the Map), removes the package name and returns the * short name, else returns the whole thing. * * Assumes that typeName contains only a package name (optional) and a short name, * potentially with subtended brackets. * * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.) */ protected static String adjustTypeName(String typeName, Map typeNameMap) { if (adjustmentNeededForType(typeName, typeNameMap)) { putTypeNameInMap(typeName, typeNameMap); return typeName.substring(packageName(typeName).length() + 1); } else { return typeName; } }
/** * Compares the typeName to those stored in the typeNameMap. * If the short name of the typeName is unambiguous (only one package for * that short name in the Map), removes the package name and returns the * short name, else returns the whole thing. * * Assumes that typeName contains only a package name (optional) and a short name, * potentially with subtended brackets. * * (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.) */ protected static String adjustTypeName(String typeName, Map typeNameMap) { if (adjustmentNeededForType(typeName, typeNameMap)) { putTypeNameInMap(typeName, typeNameMap); return typeName.substring(packageName(typeName).length() + 1); } else { return typeName; } }