/** * Parses the initial value, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustInitialValue(Map typeNameMap) { if (getInitialValue() == null) { return; } StringBuilder initialValue = new StringBuilder(getInitialValue()); Set typeNames = parseForTypeNames(initialValue.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = initialValue.toString().indexOf(typeName); while (typeNameStartIndex != -1) { initialValue.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = initialValue.toString().indexOf(typeName); } } } setInitialValue(initialValue.toString()); }
/** * Parses the initial value, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustInitialValue(Map typeNameMap) { if (getInitialValue() == null) { return; } StringBuffer initialValue = new StringBuffer(getInitialValue()); Set typeNames = parseForTypeNames(initialValue.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = initialValue.toString().indexOf(typeName); while (typeNameStartIndex != -1) { initialValue.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = initialValue.toString().indexOf(typeName); } } } setInitialValue(initialValue.toString()); }
/** * Parses the initial value, removing the package name for each type * (and adding the appropriate import) if the type is * unambiguous. */ private void adjustInitialValue(Map typeNameMap) { if (getInitialValue() == null) { return; } StringBuilder initialValue = new StringBuilder(getInitialValue()); Set typeNames = parseForTypeNames(initialValue.toString()); for (Iterator i = typeNames.iterator(); i.hasNext();) { String typeName = (String)i.next(); String adjustedTypeName = adjustTypeName(typeName, typeNameMap); if (!typeName.equals(adjustedTypeName)) { int typeNameStartIndex = initialValue.toString().indexOf(typeName); while (typeNameStartIndex != -1) { initialValue.replace(typeNameStartIndex, typeNameStartIndex + typeName.length(), adjustedTypeName); typeNameStartIndex = initialValue.toString().indexOf(typeName); } } } setInitialValue(initialValue.toString()); }