All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.jaxx.runtime.init.UIInitializerResult Maven / Gradle / Ivy

There is a newer version: 3.1.5
Show newest version
package org.nuiton.jaxx.runtime.init;

/*-
 * #%L
 * JAXX :: Runtime Spi
 * %%
 * Copyright (C) 2008 - 2024 Code Lutin, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 *
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;

import javax.swing.JComponent;
import java.util.List;
import java.util.stream.Stream;

/**
 * Result of init.
 * 

* Created on 10/12/2020. * * @author Tony Chemit - [email protected] * @since 3.0 */ public class UIInitializerResult { private final ArrayListMultimap focusComponents; private final ImmutableList dependencies; private final ArrayListMultimap, Object> components; public UIInitializerResult(UIInitializerContext context) { this.focusComponents = context.getFocusComponents(); this.dependencies = context.getDependencies(); this.components = context.getKeptComponents(); } public ImmutableList getDependencies() { return dependencies; } public ArrayListMultimap getFocusComponents() { return focusComponents; } public ArrayListMultimap, Object> getComponents() { return components; } @SuppressWarnings("unchecked") public Stream getComponents(Class componentType) { return (Stream) components.get(componentType).stream(); } @SuppressWarnings("unchecked") public Stream getSubComponents(Class componentType) { return (Stream) components.asMap().entrySet().stream().filter(e -> componentType.isAssignableFrom(e.getKey())).flatMap(e -> e.getValue().stream()); } @SuppressWarnings("unchecked") public List getComponentsList(Class componentType) { return (List) components.get(componentType); } }