Class DefaultJAXXContext

java.lang.Object
jaxx.runtime.context.DefaultJAXXContext
All Implemented Interfaces:
JAXXContext
Direct Known Subclasses:
DefaultApplicationContext, JAXXInitialContext

public class DefaultJAXXContext
extends java.lang.Object
implements JAXXContext
The default JAXXContext to be used in a JAXXObject by delegation. The values are store in a Map but we can not use directly the values as key. Because, it does not work if we add for the same object multi entries (named and unamed)... We prefer use as entry the JAXXContextEntryDef associated with the value.
Author:
Tony Chemit - chemit@codelutin.com
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.util.Map<JAXXContextEntryDef<?>,​java.lang.Object> data
    les données contenues dans le context
    protected static JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY
    entry of the parent context
    protected JAXXContext parentContext
    le context parent
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultJAXXContext()  
  • Method Summary

    Modifier and Type Method Description
    void clear()  
    <T> T getContextValue​(java.lang.Class<T> clazz)
    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[])}'/>
    <T> T getContextValue​(java.lang.Class<T> clazz, java.lang.String name)
    Seek for a named entry in the context
    protected JAXXContextEntryDef<?> getEntry​(java.lang.Class<?> klass, java.lang.String name)  
    protected JAXXContextEntryDef<?> getKey​(java.lang.String name, java.lang.Class<?> klass)  
    java.lang.String[] getKeys​(java.lang.Class<?> klass)
    Obtain all the keys of data for a given type.
    protected JAXXContext getParentContext()  
    protected <T> T remove0​(java.lang.Class<T> klass, java.lang.String name)  
    <T> void removeContextValue​(java.lang.Class<T> klazz)
    Remove from context the value with the given klazz as an unamed entry
    <T> void removeContextValue​(java.lang.Class<T> klazz, java.lang.String name)
    Remove from context the value with the given klazz as an unamed (if name is null) or named entry
    <T> void setContextValue​(T o)
    Push in the context a new unamed entry.
    <T> void setContextValue​(T o, java.lang.String name)
    * Push in the context a new amed entry.
    protected void setParentContext​(JAXXContext parentContext)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PARENT_CONTEXT_ENTRY

      protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY
      entry of the parent context
    • parentContext

      protected JAXXContext parentContext
      le context parent
    • data

      protected final java.util.Map<JAXXContextEntryDef<?>,​java.lang.Object> data
      les données contenues dans le context
  • Constructor Details

    • DefaultJAXXContext

      public DefaultJAXXContext()
  • Method Details

    • setContextValue

      public <T> void setContextValue​(T o)
      Description copied from 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.
      Specified by:
      setContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to set in context
      Parameters:
      o - the value to push in context
    • setContextValue

      public <T> void setContextValue​(T o, java.lang.String name)
      Description copied from interface: JAXXContext
      * Push in the context a new amed entry. If a previous entry exists in context (same name and class), it will be removed.
      Specified by:
      setContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to set in context
      Parameters:
      o - the value to push in context
      name - the name of the new entry
    • getContextValue

      public <T> T getContextValue​(java.lang.Class<T> clazz)
      Description copied from interface: JAXXContext
      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[])}'/>
      Specified by:
      getContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to obtain from context
      Parameters:
      clazz - the class of unamed entry to seek in context
      Returns:
      the value of the unamed entry for the given class, or null if no such entry.
    • getContextValue

      public <T> T getContextValue​(java.lang.Class<T> clazz, java.lang.String name)
      Description copied from interface: JAXXContext
      Seek for a named entry in the context
      Specified by:
      getContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to obtain from context
      Parameters:
      clazz - the class of named entry to seek in context
      name - the name of the entry to seek in context
      Returns:
      the value of the named entry for the given class, or null if no such entry.
    • removeContextValue

      public <T> void removeContextValue​(java.lang.Class<T> klazz)
      Description copied from interface: JAXXContext
      Remove from context the value with the given klazz as an unamed entry
      Specified by:
      removeContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to remove from context
      Parameters:
      klazz - the klazz entry
    • removeContextValue

      public <T> void removeContextValue​(java.lang.Class<T> klazz, java.lang.String name)
      Description copied from interface: JAXXContext
      Remove from context the value with the given klazz as an unamed (if name is null) or named entry
      Specified by:
      removeContextValue in interface JAXXContext
      Type Parameters:
      T - type of data to remove from context
      Parameters:
      klazz - the klazz entry
      name - extra name of the entry
    • getKeys

      public java.lang.String[] getKeys​(java.lang.Class<?> klass)
      Obtain all the keys of data for a given type.
      Parameters:
      klass - the type of searched keys
      Returns:
      the array of all names of keys for the given type of data
      Since:
      1.3
    • clear

      public void clear()
    • getKey

      protected JAXXContextEntryDef<?> getKey​(java.lang.String name, java.lang.Class<?> klass)
    • remove0

      protected <T> T remove0​(java.lang.Class<T> klass, java.lang.String name)
    • getEntry

      protected JAXXContextEntryDef<?> getEntry​(java.lang.Class<?> klass, java.lang.String name)
    • getParentContext

      protected JAXXContext getParentContext()
    • setParentContext

      protected void setParentContext​(JAXXContext parentContext)