001package com.nimbusds.common.id; 002 003 004import com.unboundid.ldap.sdk.DN; 005 006 007/** 008 * Represents a distinguished name (DN) identity. 009 */ 010public final class DNIdentity extends BaseIdentifier { 011 012 013 /** 014 * The DN value. 015 */ 016 private final DN dn; 017 018 019 /** 020 * Creates a new distinguished name (DN) identity. 021 * 022 * @param dn The DN, must not be {@code null}. 023 */ 024 public DNIdentity(final DN dn) { 025 026 super(dn.toString()); 027 028 this.dn = dn; 029 } 030 031 032 /** 033 * Gets the distinguished name (DN) value. 034 * 035 * @return The DN. 036 */ 037 public DN getDN() { 038 039 return dn; 040 } 041 042 043 /** 044 * Overrides {@code Object.hashCode()}. 045 * 046 * @return The object hash code. 047 */ 048 @Override 049 public int hashCode() { 050 051 return dn.hashCode(); 052 } 053 054 055 @Override 056 public boolean equals(final Object object) { 057 058 return object instanceof DNIdentity && this.toString().equals(object.toString()); 059 } 060}