
jaxx.runtime.JAXXContext Maven / Gradle / Ivy
The newest version!
package jaxx.runtime;
import java.awt.Container;
/**
* The {@link jaxx.runtime.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 chemit
*/
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 o the value to push in context
*/
public 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 o the value to push in context
* @param name the name of the new entry
*/
public void setContextValue(T o, String name);
/**
* Remove from context the value with the given klazz as an unamed entry
*
* @param klazz the klazz entry
*/
public void removeContextValue(Class klazz);
/**
* Remove from context the value with the given klazz as an unamed (if name is null) or named entry
*
* @param klazz the klazz entry
* @param name extra name of the entry
*/
public 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 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.
*/
public T getContextValue(Class clazz);
/**
* Seek for a named entry in the 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.
*/
public T getContextValue(Class clazz, String name);
/**
* Return parent's container corresponding to the Class clazz
*
* @param clazz clazz desired
* @return parent's container
*/
public O getParentContainer(Class clazz);
/**
* Return parent's container corresponding to the Class clazz
*
* @param top the top container
* @param clazz desired
* @return parent's container
*/
public O getParentContainer(Object top, Class clazz);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy