001/*
002 * JPPF.
003 * Copyright (C) 2005-2019 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.jppf.utils;
020
021import java.io.Serializable;
022
023/**
024 * A grouping of {@link TypedProperties} objects, representing multiple sets of properties while allowing to retrive vlaues as if it were a single set of properties.
025 * @param <E> the type of keys to use.
026 * @author Laurent Cohen
027 */
028public interface PropertiesCollection<E> extends Serializable {
029  /**
030   * Add the specified properties with the specified keys.
031   * @param key the key to use.
032   * @param properties the properties to add.
033   */
034  void addProperties(E key, TypedProperties properties);
035
036  /**
037   * Add the specified properties with the specified key.
038   * @param key the key to use to retrieve the properties.
039   * @return the properties to correponding to the key, or null if the key could not be found.
040   */
041  TypedProperties getProperties(E key);
042
043  /**
044   * Get all the properties as an array.
045   * @return an array of all the sets of properties.
046   */
047  TypedProperties[] getPropertiesArray();
048
049  /**
050   * Get the value of the property with the specified name.
051   * @param name the name of the property to find.
052   * @return the proerty value, or {@code null} if the property could not be found.
053   */
054  String getProperty(String name);
055
056  /**
057   * Determine whether this properties collection contains a property witht he specified key.
058   * @param name the name of the property to check.
059   * @return {@code true} if the property could be found, {@code false} otherwise.
060   */
061  boolean containsKey(String name);
062}