public class DefaultApplicationContext extends DefaultJAXXContext
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.DefaultJAXXContext| Modifier and Type | Class and Description |
|---|---|
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.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<JAXXContextEntryDef<?>,String> |
entryListened
Map of entries to watch associated with the property to fires if a
modification was found.
|
protected Map<Class<?>,Class<?>> |
forwards
Map of forwarded classes (key) to classes (values).
|
protected PropertyChangeSupport |
pcs
to manage properties modifications
|
data, PARENT_CONTEXT_ENTRY, parentContext| Constructor and Description |
|---|
DefaultApplicationContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(JAXXContextEntryDef<?> entry,
String name,
PropertyChangeListener listener)
To add a listen modification of the given entry in the context.
|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
protected void |
fireEntryChanged(Class<?> klass,
String name,
Object oldValue,
Object newValue) |
protected void |
fireEntryChanged(JAXXContextEntryDef<?> entryDef,
Object oldValue,
Object newValue) |
protected void |
firePropertyChange(String name,
Object oldValue,
Object newValue) |
<T> T |
getContextValue(Class<T> clazz,
String name)
Seek for a named entry in the context
|
PropertyChangeListener[] |
getPropertyChangeListeners() |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName) |
boolean |
hasListeners(String propertyName) |
protected Object |
newAccess(Class<?> clazz,
Object parent,
String methodName) |
protected Object |
newAccess(Class<?> clazz,
Object parent,
String methodName,
String name) |
protected Object |
newInstance(Class<?> clazz) |
<T> void |
removeContextValue(Class<T> klass,
String name)
Remove from context the value with the given klazz as an unamed (if name is null) or named entry
|
void |
removePropertyChangeListener(JAXXContextEntryDef<?> entry,
String name,
PropertyChangeListener listener)
To remove a listen modification of the given entry in the context.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
<T> void |
setContextValue(T o,
String name)
* Push in the context a new amed entry.
|
clear, getContextValue, getEntry, getKey, getKeys, getParentContext, remove0, removeContextValue, setContextValue, setParentContextprotected Map<Class<?>,Class<?>> forwards
protected Map<JAXXContextEntryDef<?>,String> entryListened
protected PropertyChangeSupport pcs
public <T> T getContextValue(Class<T> clazz, String name)
JAXXContextgetContextValue in interface JAXXContextgetContextValue in class DefaultJAXXContextT - type of data to obtain from contextclazz - the class of named entry to seek in contextname - the name of the entry to seek in contextnull if no such entry.public <T> void removeContextValue(Class<T> klass, String name)
JAXXContextremoveContextValue in interface JAXXContextremoveContextValue in class DefaultJAXXContextT - type of data to remove from contextklass - the klazz entryname - extra name of the entrypublic <T> void setContextValue(T o,
String name)
JAXXContextsetContextValue in interface JAXXContextsetContextValue in class DefaultJAXXContextT - type of data to set in contexto - the value to push in contextname - the name of the new entrypublic void addPropertyChangeListener(JAXXContextEntryDef<?> entry, String name, PropertyChangeListener listener)
entry - the entry to listenname - the property name to fire if necessarylistener - the listener to notify if entry has changedpublic void removePropertyChangeListener(JAXXContextEntryDef<?> entry, String name, PropertyChangeListener listener)
entry - the entry to listenname - the property name to fire if necessarylistener - the listener to notify if entry has changedpublic void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
public boolean hasListeners(String propertyName)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
public PropertyChangeListener[] getPropertyChangeListeners()
protected void fireEntryChanged(Class<?> klass, String name, Object oldValue, Object newValue)
protected void fireEntryChanged(JAXXContextEntryDef<?> entryDef, Object oldValue, Object newValue)
protected Object newInstance(Class<?> clazz) throws IllegalArgumentException
IllegalArgumentExceptionprotected Object newAccess(Class<?> clazz, Object parent, String methodName, String name) throws IllegalArgumentException
IllegalArgumentExceptionprotected Object newAccess(Class<?> clazz, Object parent, String methodName) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2008–2021 Code Lutin. All rights reserved.