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.annotation; 020 021import java.lang.annotation.Documented; 022import java.lang.annotation.ElementType; 023import java.lang.annotation.Retention; 024import java.lang.annotation.RetentionPolicy; 025import java.lang.annotation.Target; 026import org.jgrapes.core.Channel; 027import org.jgrapes.core.ClassChannel; 028import org.jgrapes.core.Manager; 029import org.jgrapes.core.annotation.Handler.NoChannel; 030 031/** 032 * This annotation marks a component type's attribute of type 033 * {@link Manager} as a slot for the component type's manager. 034 * A value is automatically assigned to such an attribute 035 * when the component type is attached to the component tree or by 036 * {@link org.jgrapes.core.Components#manager(ComponentType)} 037 * (or {@link org.jgrapes.core.Components#manager(ComponentType, Channel)}). 038 */ 039@Documented 040@Retention(RetentionPolicy.RUNTIME) 041@Target(ElementType.FIELD) 042public @interface ComponentManager { 043 044 /** 045 * Specifies the channel to be associated with the component type 046 * instance as a {@link ClassChannel}'s key. 047 * 048 * @return the channel 049 */ 050 Class<? extends Channel> channel() default NoChannel.class; 051 052 /** 053 * Specifies the channel to be associated with the component type 054 * instance as a {@link org.jgrapes.core.NamedChannel}'s 055 * key (a <code>String</code>). 056 * 057 * @return the channel 058 */ 059 String namedChannel() default ""; 060}