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