jaxx.runtime
Class DefaultApplicationContext

java.lang.Object
  extended by jaxx.runtime.DefaultJAXXContext
      extended by jaxx.runtime.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(java.lang.Class) and getContextValue(java.lang.Class, java.lang.String) methods. To registred a such class, just annotate your class with DefaultApplicationContext.AutoLoad.

Since:
1.2
Author:
chemit
See Also:
DefaultJAXXContext

Nested Class Summary
static interface DefaultApplicationContext.AutoLoad
          A class annotated @AutoLoad is used by context to auto instanciate the class when required.
static interface DefaultApplicationContext.MethodAccess
          A class annotated @MethodAccess is used by context to obtain the value of an entry via a declared method.
 
Field Summary
protected  java.util.Map<java.lang.Class,java.lang.Class> forwards
          Map of forwarded classes (key) to classes (values).
protected  java.beans.PropertyChangeSupport pcs
          to manage properties modifications
 
Fields inherited from class jaxx.runtime.DefaultJAXXContext
data, PARENT_CONTEXT_ENTRY, parentContext, ui
 
Constructor Summary
DefaultApplicationContext()
           
DefaultApplicationContext(JAXXObject ui)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
protected  void firePropertyChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
           
<T> T
getContextValue(java.lang.Class<T> clazz, java.lang.String name)
          Seek for a named entry in the context
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
           
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
           
 boolean hasListeners(java.lang.String propertyName)
           
protected  java.lang.Object newAccess(java.lang.Class<?> clazz, java.lang.Object parent, java.lang.String methodName)
           
protected  java.lang.Object newAccess(java.lang.Class<?> clazz, java.lang.Object parent, java.lang.String methodName, java.lang.String name)
           
protected  java.lang.Object newInstance(java.lang.Class<?> clazz)
           
<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
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 
Methods inherited from class jaxx.runtime.DefaultJAXXContext
clear, getContextValue, getKey, getKeys, getParentContainer, getParentContainer, getParentContext, getUi, remove0, removeContextValue, setContextValue, setContextValue, setParentContext, setUi
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forwards

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


pcs

protected java.beans.PropertyChangeSupport pcs
to manage properties modifications

Constructor Detail

DefaultApplicationContext

public DefaultApplicationContext()

DefaultApplicationContext

public DefaultApplicationContext(JAXXObject ui)
Method Detail

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
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,
                                   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
Parameters:
klazz - the klazz entry
name - extra name of the entry

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()

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)


Copyright © 2008-2009 CodeLutin. All Rights Reserved.