All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xti.spring.cloud.heroku.discovery.topology.HerokuSpaceTopologyApp Maven / Gradle / Ivy

The newest version!
package com.xti.spring.cloud.heroku.discovery.topology;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Optional;

public class HerokuSpaceTopologyApp {

    private String id;
    private List domains;
    private List formation;

    @JsonProperty("id")
    public String getId() {
        return id;
    }

    @JsonProperty("domains")
    public List getDomains() {
        return domains;
    }

    @JsonProperty("formation")
    public List getFormation() {
        return formation;
    }

    @JsonIgnore
    public String getAppName(){
        if(this.getDomains() != null) {
            Optional appDomainOptional = this.getDomains().stream().filter(domain -> domain.endsWith(".herokuapp.com")).findFirst();

            if (appDomainOptional.isPresent()) {
                String appDomain = appDomainOptional.get();
                return appDomain.substring(0, appDomain.indexOf(".herokuapp.com"));
            }
        }

        return null;
    }

    @Override
    public String toString() {
        return "HerokuSpaceTopologyApp{" +
                "id='" + id + '\'' +
                ", domains=" + domains +
                ", formation=" + formation +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy