ProjectMemberImpl.java 1.83 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.cq.projects.api.ProjectMember
 *  com.adobe.cq.projects.api.ProjectMemberRole
 */
package com.adobe.cq.projects.impl;

import com.adobe.cq.projects.api.ProjectMember;
import com.adobe.cq.projects.api.ProjectMemberRole;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class ProjectMemberImpl
implements ProjectMember {
    private final String id;
    private final Set<ProjectMemberRole> roles;

    public ProjectMemberImpl(String id, Set<ProjectMemberRole> roles) {
        this.id = id;
        this.roles = roles == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<ProjectMemberRole>(roles));
    }

    public /* varargs */ ProjectMemberImpl(String id, ProjectMemberRole ... roles) {
        this.id = id;
        this.roles = roles == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<ProjectMemberRole>(Arrays.asList(roles)));
    }

    public String getId() {
        return this.id;
    }

    public Set<ProjectMemberRole> getRoles() {
        return this.roles;
    }

    public String toString() {
        return "ProjectMember{id='" + this.id + '\'' + '}';
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        ProjectMemberImpl that = (ProjectMemberImpl)o;
        if (!this.id.equals(that.id)) {
            return false;
        }
        if (this.roles != null ? !this.roles.equals(that.roles) : that.roles != null) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        return this.id != null ? this.id.hashCode() : 0;
    }
}