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 */ 016 017package org.forgerock.opendj.config.client.spi; 018 019import java.util.SortedSet; 020 021import org.forgerock.opendj.config.PropertyDefinition; 022 023/** 024 * A managed object property comprising of the property's definition and its set 025 * of values. 026 * <p> 027 * The property stores the values in a sorted set in which values are compared 028 * using the comparator defined by the property definition. 029 * <p> 030 * The property keeps track of whether or not its pending set of values differs 031 * from its active values. 032 * 033 * @param <T> 034 * The type of the property. 035 */ 036public interface Property<T> { 037 038 /** 039 * Get an immutable set view of this property's active values. 040 * 041 * @return Returns an immutable set view of this property's active values. 042 * An empty set indicates that there are no active values, and any 043 * default values are applicable. 044 */ 045 SortedSet<T> getActiveValues(); 046 047 /** 048 * Get an immutable set view of this property's default values. 049 * 050 * @return Returns an immutable set view of this property's default values. 051 * An empty set indicates that there are no default values. 052 */ 053 SortedSet<T> getDefaultValues(); 054 055 /** 056 * Get an immutable set view of this property's effective values. 057 * 058 * @return Returns an immutable set view of this property's effective 059 * values. 060 */ 061 SortedSet<T> getEffectiveValues(); 062 063 /** 064 * Get an immutable set view of this property's pending values. 065 * <p> 066 * Immediately after construction, the pending values matches the active 067 * values. 068 * 069 * @return Returns an immutable set view of this property's pending values. 070 * An empty set indicates that there are no pending values, and any 071 * default values are applicable. 072 */ 073 SortedSet<T> getPendingValues(); 074 075 /** 076 * Get the property definition associated with this property. 077 * 078 * @return Returns the property definition associated with this property. 079 */ 080 PropertyDefinition<T> getPropertyDefinition(); 081 082 /** 083 * Determines whether or not this property contains any pending values. 084 * 085 * @return Returns <code>true</code> if this property does not contain any 086 * pending values. 087 */ 088 boolean isEmpty(); 089 090 /** 091 * Determines whether or not this property has been modified since it was 092 * constructed. In other words, whether or not the set of pending values 093 * differs from the set of active values. 094 * 095 * @return Returns <code>true</code> if this property has been modified 096 * since it was constructed. 097 */ 098 boolean isModified(); 099 100 /** 101 * Determines whether or not this property contains any active values. 102 * 103 * @return Returns <code>true</code> if this property does not contain any 104 * active values. 105 */ 106 boolean wasEmpty(); 107}