001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2016 ForgeRock AS. 016 */ 017 018package org.forgerock.opendj.config.client.spi; 019 020import java.util.SortedSet; 021 022import org.forgerock.opendj.config.PropertyDefinition; 023 024/** 025 * A managed object property comprising of the property's definition and its set 026 * of values. 027 * <p> 028 * The property stores the values in a sorted set in which values are compared 029 * using the comparator defined by the property definition. 030 * <p> 031 * The property keeps track of whether its pending set of values differs 032 * from its active values. 033 * 034 * @param <T> 035 * The type of the property. 036 */ 037public interface Property<T> { 038 039 /** 040 * Get an immutable set view of this property's active values. 041 * 042 * @return Returns an immutable set view of this property's active values. 043 * An empty set indicates that there are no active values, and any 044 * default values are applicable. 045 */ 046 SortedSet<T> getActiveValues(); 047 048 /** 049 * Get an immutable set view of this property's default values. 050 * 051 * @return Returns an immutable set view of this property's default values. 052 * An empty set indicates that there are no default values. 053 */ 054 SortedSet<T> getDefaultValues(); 055 056 /** 057 * Get an immutable set view of this property's effective values. 058 * 059 * @return Returns an immutable set view of this property's effective 060 * values. 061 */ 062 SortedSet<T> getEffectiveValues(); 063 064 /** 065 * Get an immutable set view of this property's pending values. 066 * <p> 067 * Immediately after construction, the pending values matches the active 068 * values. 069 * 070 * @return Returns an immutable set view of this property's pending values. 071 * An empty set indicates that there are no pending values, and any 072 * default values are applicable. 073 */ 074 SortedSet<T> getPendingValues(); 075 076 /** 077 * Get the property definition associated with this property. 078 * 079 * @return Returns the property definition associated with this property. 080 */ 081 PropertyDefinition<T> getPropertyDefinition(); 082 083 /** 084 * Determines whether this property contains any pending values. 085 * 086 * @return Returns <code>true</code> if this property does not contain any 087 * pending values. 088 */ 089 boolean isEmpty(); 090 091 /** 092 * Determines whether this property has been modified since it was 093 * constructed. In other words, whether the set of pending values 094 * differs from the set of active values. 095 * 096 * @return Returns <code>true</code> if this property has been modified 097 * since it was constructed. 098 */ 099 boolean isModified(); 100 101 /** 102 * Determines whether this property contains any active values. 103 * 104 * @return Returns <code>true</code> if this property does not contain any 105 * active values. 106 */ 107 boolean wasEmpty(); 108}