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.common.internal.StringUtils.*; 016 017import java.util.*; 018 019/** 020 * Represents a list of {@link ConfigEvent} objects. 021 * 022 * @serial exclude 023 */ 024public class ConfigEvents extends ArrayList<ConfigEvent> { 025 private static final long serialVersionUID = 1L; 026 027 /** 028 * Returns <jk>true</jk> if the specified section was modified in this list of events. 029 * 030 * @param name The section name. 031 * @return <jk>true</jk> if the specified section was modified in this list of events. 032 */ 033 public boolean isSectionModified(String name) { 034 return stream().anyMatch(x -> eq(name, x.getSection())); 035 } 036 037 /** 038 * Returns <jk>true</jk> if the specified key was modified in this list of events. 039 * 040 * @param section The section name. 041 * @param key The key name. 042 * @return <jk>true</jk> if the specified key was modified in this list of events. 043 */ 044 public boolean isKeyModified(String section, String key) { 045 return stream().anyMatch(x -> eq(section, x.getSection()) && eq(key, x.getKey())); 046 } 047}