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

brooklyn.entity.basic.PolicyDescriptor Maven / Gradle / Ivy

There is a newer version: 0.7.0-M1
Show newest version
package brooklyn.entity.basic;

import brooklyn.policy.Policy;

import com.google.common.base.Objects;

public class PolicyDescriptor {

    private final String id;
    private final String type;
    private final String name;

    public PolicyDescriptor(Policy policy) {
        this.id = policy.getId();
        this.type = policy.getPolicyType().getName();
        this.name = policy.getName();
    }
    public String getId() {
        return id;
    }
    
    public String getPolicyType() {
        return type;
    }
    
    public String getName() {
        return name;
    }
    
    @Override
    public boolean equals(Object other) {
        if (!(other instanceof PolicyDescriptor)) {
            return false;
        }
        PolicyDescriptor o = (PolicyDescriptor) other;
        return Objects.equal(id, o.id) && Objects.equal(type, o.type) && Objects.equal(name, o.name);
    }
    
    @Override
    public int hashCode() {
        return id.hashCode();
    }
    
    @Override
    public String toString() {
        return Objects.toStringHelper(this).add("id", id).add("type", type).add("name",  name).omitNullValues().toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy