PrincipalImpl.java 1.21 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.jackrabbit.api.security.principal.JackrabbitPrincipal
 */
package com.adobe.aem.formsndocuments.bootstrap;

import java.io.Serializable;
import java.security.Principal;
import org.apache.jackrabbit.api.security.principal.JackrabbitPrincipal;

public class PrincipalImpl
implements JackrabbitPrincipal,
Serializable {
    private static final long serialVersionUID = 384040549033267804L;
    private final String name;

    public PrincipalImpl(String name) {
        if (name == null || name.length() == 0) {
            throw new IllegalArgumentException("Principal name can neither be null nor empty String.");
        }
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof JackrabbitPrincipal) {
            return this.name.equals(((Principal)obj).getName());
        }
        return false;
    }

    public int hashCode() {
        return this.name.hashCode();
    }

    public String toString() {
        return this.getClass().getName() + ":" + this.name;
    }
}