I am new to Java and I use the following code to retrieve parameters from a linked hash map from the Cloud Foundry API. My question is if there is a better way to do it in Java?
public HashMap<String, String> getUserData(String Url, String org, String space, String app) throws MalformedURLException {
URL endpoint = new URL(Url);
CloudFoundryOperations ops = sm.getCurrentUserCfClient(endpoint, org, space);
GetApplicationEnvironmentsRequest request = GetApplicationEnvironmentsRequest.builder()
.name(app)
.build();
ApplicationEnvironments environments = ops.applications()
.getEnvironments(request)
.block();
Map<String, Object> mapSystemProvided = environments.getSystemProvided();
LinkedHashMap<String, Object> SERVICES = (LinkedHashMap<String, Object>) mapSystemProvided.get("SERVICES");
ArrayList<Object> apps = (ArrayList<Object>) SERVICES.get("apps");
LinkedHashMap<String, Object> appsList = (LinkedHashMap<String, Object>) apps.get(0);
LinkedHashMap<String, Object> credentials = (LinkedHashMap<String, Object>) appsList.get("credentials");
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put(ID, credentials.get(ID).toString());
parameters.put(DEFAULTS, credentials.get(DEFAULTST).toString());
return parameters;
CloudFoundryOperations
from? Is there documentation on how to use the API? \$\endgroup\$