001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.config.event;
014
015import static org.apache.juneau.internal.StringUtils.*;
016
017import java.util.*;
018
019/**
020 * Represents a list of {@link ConfigEvent} objects.
021 */
022public class ConfigEvents extends ArrayList<ConfigEvent> {
023   private static final long serialVersionUID = 1L;
024
025   /**
026    * Returns <jk>true</jk> if the specified section was modified in this list of events.
027    *
028    * @param name The section name.
029    * @return <jk>true</jk> if the specified section was modified in this list of events.
030    */
031   public boolean isSectionModified(String name) {
032      for (ConfigEvent ce : this)
033         if (isEquals(name, ce.getSection()))
034            return true;
035      return false;
036   }
037
038   /**
039    * Returns <jk>true</jk> if the specified key was modified in this list of events.
040    *
041    * @param section The section name.
042    * @param key The key name.
043    * @return <jk>true</jk> if the specified key was modified in this list of events.
044    */
045   public boolean isKeyModified(String section, String key) {
046      for (ConfigEvent ce : this)
047         if (isEquals(section, ce.getSection()) && isEquals(key, ce.getKey()))
048            return true;
049      return false;
050   }
051}