001/* 002 * JGrapes Event Driven Framework 003 * Copyright (C) 2016-2018 Michael N. Lipp 004 * 005 * This program is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Affero General Public License as published by 007 * the Free Software Foundation; either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, but 011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 013 * for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License along 016 * with this program; if not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jgrapes.core; 020 021import org.jgrapes.core.annotation.ComponentManager; 022 023/** 024 * This interface marks a class as a component. Implementing this interface is 025 * an alternative to deriving from {@link Component} (usually because 026 * there is some other preferential inheritance relationship). 027 * Components that implement this interface (but don't inherit from 028 * {@link Component}) aren't inserted as vertices into the component tree; 029 * rather, they are represented in the tree by a proxy. 030 * 031 * Classes that implement {@code ComponentType} aren't required to 032 * implement specific methods. They must, however, declare a field 033 * for a component manager. This field must be of type 034 * {@link Manager} and annotated as {@link ComponentManager}. 035 * The implementation of the component type can use the value in this 036 * field to get access to the component hierarchy. The field is initialized 037 * when the component type is added to the component hierarchy or when 038 * calling {@link Components#manager(ComponentType)} or 039 * {@link Components#manager(ComponentType, Channel)}. 040 * 041 * The channel associated with an instance of {@link ComponentType} 042 * can be specified as attribute of the {@link ComponentManager} 043 * annotation. If no channel is specified, the proxy is used as 044 * channel (see {@link Channel#SELF}). The default can be overridden 045 * on a per instance basis by calling 046 * {@link Components#manager(ComponentType, Channel)} before the component 047 * is added to the tree. 048 */ 049public interface ComponentType { 050 051}