brooklyn.location.basic.BasicLocationDefinition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-core Show documentation
Show all versions of brooklyn-core Show documentation
Entity implementation classes, events, and other core elements
package brooklyn.location.basic;
import java.util.Map;
import brooklyn.location.LocationDefinition;
import brooklyn.util.text.Identifiers;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
public class BasicLocationDefinition implements LocationDefinition {
private final String id;
private final String name;
private final String spec;
private final Map config;
public BasicLocationDefinition(String name, String spec, Map config) {
this(Identifiers.makeRandomId(8), name, spec, config);
}
public BasicLocationDefinition(String id, String name, String spec, Map config) {
this.id = Preconditions.checkNotNull(id);
this.name = name;
this.spec = Preconditions.checkNotNull(spec);
this.config = config==null ? ImmutableMap.of() : ImmutableMap.copyOf(config);
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getSpec() {
return spec;
}
@Override
public Map getConfig() {
return config;
}
@Override
public boolean equals(Object o) {
if (this==o) return true;
if ((o instanceof LocationDefinition) && id.equals(((LocationDefinition)o).getId())) return true;
return false;
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public String toString() {
return "LocationDefinition{" +
"id='" + getId() + '\'' +
", name='" + getName() + '\'' +
", spec='" + getSpec() + '\'' +
", config=" + getConfig() +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy