|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.knipp.rritoolkit.DefaultResponseFactory
public class DefaultResponseFactory
default implementation of the response factory
Nested Class Summary | |
---|---|
protected class |
DefaultResponseFactory.ClassRule
rule that uses the request for the selection of the suitable response |
protected static class |
DefaultResponseFactory.KeyRule
rule that tests for the existance of certain keys |
protected static class |
DefaultResponseFactory.ListRule
small class that describes a rule for choosing a specific subclass |
Field Summary | |
---|---|
private java.lang.Class<? extends Response> |
defaultClass
the default class |
private java.util.SortedSet<DefaultResponseFactory.ListRule> |
rules
the set of rules |
private static DefaultResponseFactory |
singleton
singleton instance with default settings |
private java.util.Map<javax.xml.namespace.QName,java.lang.Class<? extends Response>> |
xmlMap
map from the name of the first element to the class |
Constructor Summary | |
---|---|
protected |
DefaultResponseFactory()
constructor. |
Method Summary | |
---|---|
protected void |
addRule(DefaultResponseFactory.ListRule rule)
add a list rule |
protected void |
addXmlMapping(javax.xml.namespace.QName qName,
java.lang.Class<? extends Response> cls)
add an XML mapping |
protected void |
addXmlMapping(java.lang.String uri,
java.lang.String localName,
java.lang.Class<? extends Response> cls)
add an XML mapping |
protected void |
createDefaults()
create the default entries |
protected Response |
createInstance(java.lang.Class<? extends Response> cls)
create an instance of the given class, mapping the special exceptions to RuntimeExceptions |
Response |
createResponse(org.w3c.dom.Document doc,
Request request)
create an instance based on the given XML document. |
Response |
createResponse(KVMultiList list,
Request request)
create an instance based on the given key-value pair list. |
static ResponseFactory |
getFactory()
return the default factory |
protected void |
setDefaultClass(java.lang.Class<? extends Response> cls)
set the default class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map<javax.xml.namespace.QName,java.lang.Class<? extends Response>> xmlMap
private java.util.SortedSet<DefaultResponseFactory.ListRule> rules
private java.lang.Class<? extends Response> defaultClass
private static DefaultResponseFactory singleton
Constructor Detail |
---|
protected DefaultResponseFactory()
createDefaults
needs to be called.
Method Detail |
---|
protected void setDefaultClass(java.lang.Class<? extends Response> cls)
cls
- the default classprotected void addXmlMapping(javax.xml.namespace.QName qName, java.lang.Class<? extends Response> cls)
qName
- the name of the XML elementcls
- the classprotected void addXmlMapping(java.lang.String uri, java.lang.String localName, java.lang.Class<? extends Response> cls)
uri
- the namespace URIlocalName
- the local namecls
- the classprotected void addRule(DefaultResponseFactory.ListRule rule)
rule
- the ruleprotected void createDefaults()
public static ResponseFactory getFactory()
protected Response createInstance(java.lang.Class<? extends Response> cls)
cls
- the class to instantiate
public Response createResponse(org.w3c.dom.Document doc, Request request) throws org.w3c.dom.DOMException, ResponseParseException
createResponse
in interface ResponseFactory
doc
- the documentrequest
- the request, may be null
org.w3c.dom.DOMException
- on DOM exceptions
ResponseParseException
- if the type could not be determinedpublic Response createResponse(KVMultiList list, Request request) throws ResponseParseException
createResponse
in interface ResponseFactory
list
- the listrequest
- the request, may be null
ResponseParseException
- if the type could not be determined
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |