I have a below code which constructs the URL given a FlowType enum.
private String getURL(FlowType type) throws Exception {
StringBuilder url = new StringBuilder();
if (TestUtils.isProduction()) {
if (type.equals(FlowType.HOLDER)) {
url.append(VISITOR);
} else {
url.append(USER);
}
} else {
if (type.equals(FlowType.HOLDER)) {
url.append(VISITOR_STAGE);
} else {
url.append(USER_STAGE);
}
}
long version = 0;
if (DataMapping.isInitialized()) {
if (!TestUtils.isEmpty(DataMapping.getPartition(type))) {
version = DataMapping.getPartition(type).getVersion();
}
}
url.append("web/hasChanged?ver=" + version);
return url.toString();
}
I wanted to review this code. Any improvements or suggestions?