001package com.nimbusds.infinispan.persistence.ldap; 002 003 004import com.unboundid.ldap.sdk.ReadOnlyEntry; 005import net.jcip.annotations.Immutable; 006 007 008/** 009 * Encapsulates an LDAP entry with optional write strategy. 010 */ 011@Immutable 012public final class LDAPEntry { 013 014 015 /** 016 * The LDAP entry consisting of DN and attributes. 017 */ 018 private final ReadOnlyEntry entry; 019 020 021 /** 022 * Optional write strategy for the entry, {@code null} if not 023 * specified. 024 */ 025 private final LDAPWriteStrategy writeStrategy; 026 027 028 /** 029 * Creates a new LDAP entry. No write strategy is specified. 030 * 031 * @param entry The LDAP entry consisting of DN and attributes. Must 032 * not be {@code null}. 033 */ 034 public LDAPEntry(final ReadOnlyEntry entry) { 035 036 this(entry, null); 037 } 038 039 040 /** 041 * Creates a new LDAP entry with optional write strategy. 042 * 043 * @param entry The LDAP entry consisting of DN and 044 * attributes. Must not be {@code null}. 045 * @param writeStrategy Write strategy for the entry, {@code null} if 046 * not specified. 047 */ 048 public LDAPEntry(final ReadOnlyEntry entry, final LDAPWriteStrategy writeStrategy) { 049 assert entry != null; 050 this.entry = entry; 051 this.writeStrategy = writeStrategy; 052 } 053 054 055 /** 056 * Returns the LDAP entry. 057 * 058 * @return The LDAP entry. 059 */ 060 public ReadOnlyEntry getEntry() { 061 return entry; 062 } 063 064 065 /** 066 * Returns the write strategy for the entry. 067 * 068 * @return The write strategy, {@code null} if not specified. 069 */ 070 public LDAPWriteStrategy getWriteStrategy() { 071 return writeStrategy; 072 } 073}