Class DefaultApplicationContext

java.lang.Object
jaxx.runtime.context.DefaultJAXXContext
jaxx.runtime.context.DefaultApplicationContext
All Implemented Interfaces:
JAXXContext

public class DefaultApplicationContext
extends DefaultJAXXContext
The default context to be used for an application. This extends the DefaultJAXXContext and add a possibility to auto-instanciate some classes asked via DefaultJAXXContext.getContextValue(Class) and getContextValue(Class, String) methods. To registred a such class, just annotate your class with DefaultApplicationContext.AutoLoad.
Since:
1.2
Author:
Tony Chemit - chemit@codelutin.com
See Also:
DefaultJAXXContext
  • Field Details

    • forwards

      protected java.util.Map<java.lang.Class<?>,​java.lang.Class<?>> forwards
      Map of forwarded classes (key) to classes (values).
    • entryListened

      protected java.util.Map<JAXXContextEntryDef<?>,​java.lang.String> entryListened
      Map of entries to watch associated with the property to fires if a modification was found.
    • pcs

      protected java.beans.PropertyChangeSupport pcs
      to manage properties modifications
  • Constructor Details

    • DefaultApplicationContext

      public DefaultApplicationContext()
  • Method Details

    • 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
      Overrides:
      getContextValue in class DefaultJAXXContext
      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> klass, 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
      Overrides:
      removeContextValue in class DefaultJAXXContext
      Type Parameters:
      T - type of data to remove from context
      Parameters:
      klass - the klazz entry
      name - extra name of the entry
    • 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
      Overrides:
      setContextValue in class DefaultJAXXContext
      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
    • addPropertyChangeListener

      public void addPropertyChangeListener​(JAXXContextEntryDef<?> entry, java.lang.String name, java.beans.PropertyChangeListener listener)
      To add a listen modification of the given entry in the context.
      Parameters:
      entry - the entry to listen
      name - the property name to fire if necessary
      listener - the listener to notify if entry has changed
      Since:
      2.0.1
    • removePropertyChangeListener

      public void removePropertyChangeListener​(JAXXContextEntryDef<?> entry, java.lang.String name, java.beans.PropertyChangeListener listener)
      To remove a listen modification of the given entry in the context.
      Parameters:
      entry - the entry to listen
      name - the property name to fire if necessary
      listener - the listener to notify if entry has changed
      Since:
      2.0.1
    • addPropertyChangeListener

      public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener​(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener​(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
    • hasListeners

      public boolean hasListeners​(java.lang.String propertyName)
    • getPropertyChangeListeners

      public java.beans.PropertyChangeListener[] getPropertyChangeListeners​(java.lang.String propertyName)
    • getPropertyChangeListeners

      public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
    • fireEntryChanged

      protected void fireEntryChanged​(java.lang.Class<?> klass, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
    • fireEntryChanged

      protected void fireEntryChanged​(JAXXContextEntryDef<?> entryDef, java.lang.Object oldValue, java.lang.Object newValue)
    • newInstance

      protected java.lang.Object newInstance​(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentException
      Throws:
      java.lang.IllegalArgumentException
    • newAccess

      protected java.lang.Object newAccess​(java.lang.Class<?> clazz, java.lang.Object parent, java.lang.String methodName, java.lang.String name) throws java.lang.IllegalArgumentException
      Throws:
      java.lang.IllegalArgumentException
    • newAccess

      protected java.lang.Object newAccess​(java.lang.Class<?> clazz, java.lang.Object parent, java.lang.String methodName) throws java.lang.IllegalArgumentException
      Throws:
      java.lang.IllegalArgumentException
    • firePropertyChange

      protected void firePropertyChange​(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)