summaryrefslogtreecommitdiffstats
path: root/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
diff options
context:
space:
mode:
Diffstat (limited to 'application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java')
-rw-r--r--application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
index d18ced478f1..e53058f40e3 100644
--- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
+++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
@@ -1,9 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.applicationmodel;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
/**
@@ -16,6 +18,7 @@ public class ServiceCluster {
private final ClusterId clusterId;
private final ServiceType serviceType;
private final Set<ServiceInstance> serviceInstances;
+ private Optional<ApplicationInstance> applicationInstance = Optional.empty();
public ServiceCluster(ClusterId clusterId, ServiceType serviceType, Set<ServiceInstance> serviceInstances) {
this.clusterId = clusterId;
@@ -38,12 +41,25 @@ public class ServiceCluster {
return serviceInstances;
}
+ @JsonIgnore
+ public void setApplicationInstance(ApplicationInstance applicationInstance) {
+ this.applicationInstance = Optional.of(applicationInstance);
+ }
+
+ @JsonIgnore
+ public ApplicationInstance getApplicationInstance() {
+ return applicationInstance.get();
+ }
+
@Override
public String toString() {
return "ServiceCluster{" +
"clusterId=" + clusterId +
", serviceType=" + serviceType +
", serviceInstances=" + serviceInstances +
+ (applicationInstance.isPresent() ?
+ ", applicationInstance=" + applicationInstance.get() :
+ "") +
'}';
}
@@ -54,12 +70,12 @@ public class ServiceCluster {
ServiceCluster that = (ServiceCluster) o;
return Objects.equals(clusterId, that.clusterId) &&
Objects.equals(serviceType, that.serviceType) &&
- Objects.equals(serviceInstances, that.serviceInstances);
+ Objects.equals(serviceInstances, that.serviceInstances) &&
+ Objects.equals(applicationInstance, that.applicationInstance);
}
@Override
public int hashCode() {
- return Objects.hash(clusterId, serviceType, serviceInstances);
+ return Objects.hash(clusterId, serviceType, serviceInstances, applicationInstance);
}
-
}