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