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; 018 019import java.util.Collection; 020import java.util.Collections; 021 022/** 023 * An interface which can be used to initialize the contents of a managed 024 * object. 025 */ 026public interface PropertyProvider { 027 028 /** 029 * A property provider which always returns empty property values, 030 * indicating default behavior. 031 */ 032 PropertyProvider DEFAULT_PROVIDER = new PropertyProvider() { 033 034 /** {@inheritDoc} */ 035 public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d) { 036 return Collections.<T> emptySet(); 037 } 038 039 }; 040 041 /** 042 * Get the property values associated with the specified property 043 * definition. 044 * <p> 045 * Implementations are not required to validate the values that they 046 * provide. Specifically: 047 * <ul> 048 * <li>they do not need to guarantee that the provided values are valid 049 * according to the property's syntax 050 * <li>they do not need to provide values for mandatory properties 051 * <li>they do not need to ensure that single-valued properties do contain 052 * at most one value. 053 * </ul> 054 * The returned set of values is allowed to contain duplicates. 055 * 056 * @param <T> 057 * The underlying type of the property. 058 * @param d 059 * The Property definition. 060 * @return Returns a newly allocated set containing a copy of the property's 061 * values. An empty set indicates that the property has no values 062 * defined and any default behavior is applicable. 063 * @throws IllegalArgumentException 064 * If this property provider does not recognise the requested 065 * property definition. 066 */ 067 <T> Collection<T> getPropertyValues(PropertyDefinition<T> d); 068}