/** * Returns the Well Know Text from a code. * * @param code Value allocated by authority. * @return The Well Know Text (WKT) for the specified code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. */ public String getWKT(final String code) throws NoSuchAuthorityCodeException { ensureNonNull("code", code); final String wkt = definitions.getProperty(trimAuthority(code)); if (wkt == null) { throw noSuchAuthorityCode(IdentifiedObject.class, code); } return wkt.trim(); }
/** Add the authority code to the specified properties, if not already present. */ @Override protected Map<String, Object> alterProperties(Map<String, Object> properties) { Object candidate = properties.get(IdentifiedObject.IDENTIFIERS_KEY); if (candidate == null && code != null) { properties = new HashMap<String, Object>(properties); code = trimAuthority(code); final Object identifiers; if (authorities.length <= 1) { identifiers = new NamedIdentifier(authority, code); } else { final NamedIdentifier[] ids = new NamedIdentifier[authorities.length]; for (int i = 0; i < ids.length; i++) { ids[i] = new NamedIdentifier(authorities[i], code); } identifiers = ids; } properties.put(IdentifiedObject.IDENTIFIERS_KEY, identifiers); } return super.alterProperties(properties); } }