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.opends.server.admin.client.spi;
028
029
030
031import java.util.SortedSet;
032
033import org.opends.server.admin.PropertyDefinition;
034
035
036
037/**
038 * A managed object property comprising of the property's definition
039 * and its set of values.
040 * <p>
041 * The property stores the values in a sorted set in which values are
042 * compared using the comparator defined by the property definition.
043 * <p>
044 * The property keeps track of whether or not its pending set of
045 * values differs from its active values.
046 *
047 * @param <T>
048 *          The type of the property.
049 */
050public interface Property<T> {
051
052  /**
053   * Get an immutable set view of this property's active values.
054   *
055   * @return Returns an immutable set view of this property's active
056   *         values. An empty set indicates that there are no active
057   *         values, and any default values are applicable.
058   */
059  SortedSet<T> getActiveValues();
060
061
062
063  /**
064   * Get an immutable set view of this property's default values.
065   *
066   * @return Returns an immutable set view of this property's default
067   *         values. An empty set indicates that there are no default
068   *         values.
069   */
070  SortedSet<T> getDefaultValues();
071
072
073
074  /**
075   * Get an immutable set view of this property's effective values.
076   *
077   * @return Returns an immutable set view of this property's
078   *         effective values.
079   */
080  SortedSet<T> getEffectiveValues();
081
082
083
084  /**
085   * Get an immutable set view of this property's pending values.
086   * <p>
087   * Immediately after construction, the pending values matches the
088   * active values.
089   *
090   * @return Returns an immutable set view of this property's pending
091   *         values. An empty set indicates that there are no pending
092   *         values, and any default values are applicable.
093   */
094  SortedSet<T> getPendingValues();
095
096
097
098  /**
099   * Get the property definition associated with this property.
100   *
101   * @return Returns the property definition associated with this
102   *         property.
103   */
104  PropertyDefinition<T> getPropertyDefinition();
105
106
107
108  /**
109   * Determines whether or not this property contains any pending
110   * values.
111   *
112   * @return Returns <code>true</code> if this property does not
113   *         contain any pending values.
114   */
115  boolean isEmpty();
116
117
118
119  /**
120   * Determines whether or not this property has been modified since
121   * it was constructed. In other words, whether or not the set of
122   * pending values differs from the set of active values.
123   *
124   * @return Returns <code>true</code> if this property has been
125   *         modified since it was constructed.
126   */
127  boolean isModified();
128
129
130
131  /**
132   * Determines whether or not this property contains any active
133   * values.
134   *
135   * @return Returns <code>true</code> if this property does not
136   *         contain any active values.
137   */
138  boolean wasEmpty();
139}