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

org.nuiton.jaxx.runtime.JAXXContext Maven / Gradle / Ivy

There is a newer version: 3.1.5
Show newest version
/*
 * #%L
 * JAXX :: Runtime Spi
 * %%
 * Copyright (C) 2008 - 2020 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%
 */
package org.nuiton.jaxx.runtime;

/**
 * The {@link JAXXContext} contract defines a generic context.
 *
 * A context contains two king of entries :
 *
 * 

Unamed entry

* a such entry maps filter only on the clas of the object of the entry. * * To add a unamed entry, use {@link #setContextValue(Object)} and {@link #getContextValue(Class)} to reteave a * such entry. * *

named entry

* a such entry filter on class of the object and on the name of the entry. * * To add a named entry, use {@link #setContextValue(Object, String)} and {@link #getContextValue(Class, String)} * to reteave a such entry. * * @author letellier * @author Tony Chemit - [email protected] */ public interface JAXXContext { /** * Push in the context a new unamed entry. * * If a previous entry exists in context (unamed and same class), it will be removed. * * @param type of data to set in context * @param o the value to push in context */ void setContextValue(T o); /** * * Push in the context a new amed entry. * * If a previous entry exists in context (same name and class), it will be removed. * * @param type of data to set in context * @param o the value to push in context * @param name the name of the new entry */ void setContextValue(T o, String name); /** * Remove from context the value with the given klazz as an unamed entry * * @param type of data to remove from context * @param klazz the klazz entry */ void removeContextValue(Class klazz); /** * Remove from context the value with the given klazz as an unamed (if name is null) or named entry * * @param type of data to remove from context * @param klazz the klazz entry * @param name extra name of the entry */ void removeContextValue(Class klazz, String name); /** * Seek for a unamed entry in the context * * This is an exemple to call a method in JAXX : * * <JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/> * * @param type of data to obtain from context * @param clazz the class of unamed entry to seek in context * @return the value of the unamed entry for the given class, or null if no such entry. */ T getContextValue(Class clazz); /** * Seek for a named entry in the context * * @param type of data to obtain from context * @param clazz the class of named entry to seek in context * @param name the name of the entry to seek in context * @return the value of the named entry for the given class, or null if no such entry. */ T getContextValue(Class clazz, String name); // /** // * Return parent's container corresponding to the Class clazz // * // * @param type of container to obtain from context // * @param clazz clazz desired // * @return parent's container // * @deprecated since 2.0.0 : breaks neutral since Swing // */ // @Deprecated // public O getParentContainer(Class clazz); // // /** // * Return parent's container corresponding to the Class clazz // * // * @param type of container to obtain from context // * @param top the top container // * @param clazz desired // * @return parent's container // * @deprecated since 2.0.0 : breaks neutral since Swing // */ // @Deprecated // public O getParentContainer(Object top, Class clazz); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy