/** * Start an error message by appending the location of the object (if available) to * {@link #errorMessageBuilder()}. * * If a location is not known for the specified object, the {@link #errorMessageBuilder()} * is not modified. * * @param object that to use to lookup for a location to append to {@link #errorMessageBuilder()}. * @return {@link #errorMessageBuilder()}. */ protected StringBuilder startErrorMessage(Object object) { if (object != null) { DataLocation dataLocation = lookupDataLocation(object); if (dataLocation != null) { errorMessageBuilder().append(dataLocation).append(": "); } } return errorMessageBuilder(); }
/** * Parse a {@link DataMap} to obtain a {@link Name}. * * Return an empty {@link Name} (see {@link Name#isEmpty()}) if * a name cannot be obtained from the {@link DataMap}. * * @param map to parse. * @param nameKey is the key used to find the name in the map. * @param currentNamespace is the current namespace. * @return a {@link Name} parsed from the {@link DataMap}. */ protected Name getNameFromDataMap(DataMap map, String nameKey, String currentNamespace) { String nameString = getString(map, nameKey, true); String namespaceString = getString(map, NAMESPACE_KEY, false); Name name = getName(nameString, namespaceString, currentNamespace); // associate a name with a location, // this allows error messages such re-definition of a name to include a location. addToDataLocationMap(name, lookupDataLocation(nameString)); return name; }