|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dyuproject.ioc.ApplicationContext
public final class ApplicationContext
The context where you can find/get objects configured via json
Field Summary | |
---|---|
static String |
DEFAULT_RESOURCE_LOCATION
The default resource location ("application.json") |
Constructor Summary | |
---|---|
ApplicationContext()
|
|
ApplicationContext(ApplicationContext imported)
|
Method Summary | |
---|---|
void |
addImport(ApplicationContext imported)
Adds another ApplicationContext as an import to this context. |
void |
addRefs(References refs)
Adds References to this context. |
void |
destroy()
Destroys this object and clears all references to other objects. |
Object |
findPojo(String key)
Finds an object from a given key - the imports are included in the lookup. |
Object |
findRef(String key)
Finds an object bound to References in this context - the imports
are included in the lookup. |
Object |
getPojo(String key)
Finds an object from a given key. |
Object |
getRef(String key)
Finds an object bound to References in this context. |
static ApplicationContext |
load()
Loads the ApplicationContext from the default resource DEFAULT_RESOURCE_LOCATION }. |
static ApplicationContext |
load(File resource)
Loads the ApplicationContext from the specified File . |
static ApplicationContext |
load(InputStream resource)
Loads the ApplicationContext from the specified InputStream . |
static ApplicationContext |
load(Reader resource)
Loads the ApplicationContext from the specified Reader . |
static ApplicationContext |
load(Resource resource,
Parser parser)
Loads the ApplicationContext from the specified Resource and Parser . |
static ApplicationContext |
load(String resource)
Loads the ApplicationContext from the given resource which could be
a file, remote url (prefixed with "http://") or from the
classpath (prefixed with "classpath:"). |
static ApplicationContext |
load(String[] resources)
Loads the ApplicationContext from multiple resources. |
static ApplicationContext |
load(URL resource)
Loads the ApplicationContext from the specified URL . |
static void |
main(String[] args)
|
boolean |
setPojo(String key,
Object value)
Sets an object identified by the key. |
void |
setPojos(Map<String,Object> pojos)
Sets a map of objects on this context identified by their corresponding keys. |
boolean |
setRef(String key,
Object value)
Sets an object bound to References in this context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_RESOURCE_LOCATION
Constructor Detail |
---|
public ApplicationContext()
public ApplicationContext(ApplicationContext imported)
Method Detail |
---|
public static ApplicationContext load()
DEFAULT_RESOURCE_LOCATION
}.
public static ApplicationContext load(String resource)
ApplicationContext
from the given resource which could be
a file, remote url (prefixed with "http://") or from the
classpath (prefixed with "classpath:").
public static ApplicationContext load(File resource)
ApplicationContext
from the specified File
.
public static ApplicationContext load(URL resource)
ApplicationContext
from the specified URL
.
public static ApplicationContext load(InputStream resource)
ApplicationContext
from the specified InputStream
.
public static ApplicationContext load(Reader resource)
ApplicationContext
from the specified Reader
.
public static ApplicationContext load(Resource resource, Parser parser)
ApplicationContext
from the specified Resource
and Parser
.
public static ApplicationContext load(String[] resources)
ApplicationContext
from multiple resources.
The contents are merged into a single ApplicationContext.
public static void main(String[] args)
public Object findPojo(String key)
public Object getPojo(String key)
public boolean setPojo(String key, Object value)
key
is null.
public Object findRef(String key)
References
in this context - the imports
are included in the lookup.
public Object getRef(String key)
References
in this context.
public boolean setRef(String key, Object value)
References
in this context.
public void addRefs(References refs)
References
to this context.
public void addImport(ApplicationContext imported)
ApplicationContext
as an import to this context.
public void setPojos(Map<String,Object> pojos)
public void destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |