private void merge(Method method) { // TODO(user): Cleanup the use of apiVersion restVersions (VersionAttribute vs // RestVersionsAttribute) in the tools framework. Some references are using the attributes // incorrectly due to the confusion caused by the names. String apiVersion = deriveApiVersion(method); Set<String> restVersions = calculateRestVersions(method); method.putAttribute(VersionAttribute.KEY, VersionAttribute.create(apiVersion)); // UM uses the logical version with a suffix appended, if defined. String versionSuffix = method.getModel().getApiV1VersionSuffix(); method.putAttribute(VersionAttribute.USAGE_MANAGER_KEY, VersionAttribute.create(ApiVersionUtil.appendVersionSuffix(apiVersion, versionSuffix))); // Add the rest versions into RestVersionsAttribute only if parent of the method is included in // the model roots. if (roots.contains(method.getParent())) { if (getModel().hasAttribute(RestVersionsAttribute.KEY)) { getModel().getAttribute(RestVersionsAttribute.KEY).getVersions().addAll(restVersions); } else { getModel().putAttribute(RestVersionsAttribute.KEY, new RestVersionsAttribute(restVersions)); } } }
private void merge(Method method) { // TODO(user): Cleanup the use of apiVersion restVersions (VersionAttribute vs // RestVersionsAttribute) in the tools framework. Some references are using the attributes // incorrectly due to the confusion caused by the names. String apiVersion = deriveApiVersion(method); Set<String> restVersions = calculateRestVersions(method); method.putAttribute(VersionAttribute.KEY, VersionAttribute.create(apiVersion)); // UM uses the logical version with a suffix appended, if defined. String versionSuffix = method.getModel().getApiV1VersionSuffix(); method.putAttribute(VersionAttribute.USAGE_MANAGER_KEY, VersionAttribute.create(ApiVersionUtil.appendVersionSuffix(apiVersion, versionSuffix))); // Add the rest versions into RestVersionsAttribute only if parent of the method is included in // the model roots. if (roots.contains(method.getParent())) { if (getModel().hasAttribute(RestVersionsAttribute.KEY)) { getModel().getAttribute(RestVersionsAttribute.KEY).getVersions().addAll(restVersions); } else { getModel().putAttribute(RestVersionsAttribute.KEY, new RestVersionsAttribute(restVersions)); } } }