|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cookxml.core.DecodeEngine
This class does the actual internal decoding.
Field Summary | |
static String |
XML_NS
the XML namespace for xmlns:... attributes. |
Method Summary | |
void |
addChild(String parentNS,
String parentTag,
Element elm,
Object parentObj,
Object childObj)
This function calls addChildUnchecked and calls ExceptionHandler to handle any exceptions generated. |
void |
addCleanupHook(CleanupHook hook)
Add a CleanupHook for cleaning up work after DecodeEngine finishes, if the hook was not yet in the hook list. |
void |
addCurrentSkipList(Attr attr)
|
void |
callSetter(String ns,
String tag,
String attrNS,
String attr,
Object obj,
Object value)
|
void |
cleanup()
This function is to be called by CookXml after DecodeEngine finishes decoding XML. |
static DecodeEngine |
createDecodeEngine(CookXml cookXml,
VarLookup varLookup,
StringHook stringHook)
|
static Object |
decode(Document document,
CookXml cookXml,
VarLookup varLookup,
StringHook stringHook)
|
static Object |
decode(Element elm,
CookXml cookXml,
VarLookup varLookup,
StringHook stringHook)
|
static Object |
decode(String parentNS,
String parentTag,
Document document,
Object parentObj,
CookXml cookXml,
VarLookup varLookup,
StringHook stringHook)
|
static Object |
decode(String parentNS,
String parentTag,
Element elm,
Object parentObj,
CookXml cookXml,
VarLookup varLookup,
StringHook stringHook)
|
Object |
decodeElement(Element elm)
|
Object |
decodeElement(String parentNS,
String parentTag,
Element elm,
Object parentObj)
|
CookXml |
getCookXml()
|
Element |
getCurrentElement()
returns the current DOM element being decoded. |
String |
getCurrentTag()
|
Document |
getDocument()
|
Handler |
getHandler(String ns,
String tag,
String attr)
retrieve a handler from cache using the key pair. |
Object |
getParent(Object child)
|
String |
getPrefixNameSpace(String prefix)
Get the namespace associated with the namespace. |
Object |
getProperty(String key)
Get data for a given key. |
StringHook |
getStringHook()
|
Object |
getVariable(String name)
|
VarLookup |
getVarLookup()
returns the variable lookup handler. |
void |
handleException(String msg,
Exception ex)
A short hand for calling CookXml.getExceptionHandler and then call it to handle the exception. |
DecodeEngine |
newInstance()
|
Object |
peekData()
Peek the data on stack. |
Object |
popData()
Pop the data off stack. |
void |
pushData(Object data)
Push data onto stack. |
void |
removeCleanupHook(CleanupHook hook)
Removes a CleanupHook for cleaning up work after DecodeEngine finishes. |
void |
setAddAction(AddAction addAction)
This function set the current AddAction for addChild call. |
void |
setCurrentId(String id)
|
void |
setCurrentTag(String tag)
|
void |
setCurrentTag(String ns,
String tag)
|
void |
setCurrentVar(String var)
|
void |
setDoAdd(boolean b)
this function is mainly for the creators to tell the DecodeEngine not to add the object to the parent while it is being created. |
void |
setDocument(Document document)
|
void |
setDoProcessChildren(boolean b)
this function is mainly for the creators to tell the DecodeEngine not to process child nodes of the current one. |
void |
setHandler(String ns,
String tag,
String attr,
Handler handler)
save a handler into cache using the key pair. |
void |
setParent(Object parentObj,
Object childObj)
Set the parentObj childObj relationship by using childObj as the key for lookup its parentObj. |
Object |
setProperty(String key,
Object value)
Set data for a given key. |
void |
setStringHook(StringHook stringHook)
|
void |
setVariable(String name,
Object value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String XML_NS
Method Detail |
public static DecodeEngine createDecodeEngine(CookXml cookXml, VarLookup varLookup, StringHook stringHook)
public static Object decode(Document document, CookXml cookXml, VarLookup varLookup, StringHook stringHook) throws CookXmlException
CookXmlException
public static Object decode(String parentNS, String parentTag, Document document, Object parentObj, CookXml cookXml, VarLookup varLookup, StringHook stringHook) throws CookXmlException
CookXmlException
public static Object decode(Element elm, CookXml cookXml, VarLookup varLookup, StringHook stringHook) throws CookXmlException
CookXmlException
public static Object decode(String parentNS, String parentTag, Element elm, Object parentObj, CookXml cookXml, VarLookup varLookup, StringHook stringHook) throws CookXmlException
CookXmlException
public DecodeEngine newInstance()
public Object decodeElement(Element elm) throws CookXmlException
CookXmlException
public Object decodeElement(String parentNS, String parentTag, Element elm, Object parentObj) throws CookXmlException
CookXmlException
public void callSetter(String ns, String tag, String attrNS, String attr, Object obj, Object value) throws SetterException
SetterException
public void addChild(String parentNS, String parentTag, Element elm, Object parentObj, Object childObj) throws CookXmlException
parentNS
- the name space of the parentTag.parentTag
- parentTag of the parent element.elm
- the current element.parentObj
- the parent object.childObj
- the current object to be added to the parent.
CookXmlException
- the exception is thrown when errors occur.public CookXml getCookXml()
public Object getParent(Object child)
public Element getCurrentElement()
public void setParent(Object parentObj, Object childObj)
parentObj
- the parentObj object.childObj
- the childObj object.public VarLookup getVarLookup()
public Object getVariable(String name) throws VarLookupException
VarLookupException
public void setVariable(String name, Object value) throws VarLookupException
VarLookupException
public Handler getHandler(String ns, String tag, String attr)
ns
- the namespace of the tag.tag
- the tag name of the key.attr
- the attribute name of the key.
public void setHandler(String ns, String tag, String attr, Handler handler)
ns
- the namespace of the tag.tag
- the tag name of the key.attr
- the attribute name of the key.handler
- the handler to be put in the cache.public String getCurrentTag()
public void setCurrentTag(String tag)
public void setCurrentTag(String ns, String tag)
public void setCurrentId(String id)
public void setCurrentVar(String var)
public void addCurrentSkipList(Attr attr)
public StringHook getStringHook()
public void setStringHook(StringHook stringHook)
public Document getDocument()
public void setDocument(Document document)
public void pushData(Object data)
data
- data to be pushed onto stack.public Object popData()
public Object peekData()
public void setDoAdd(boolean b)
b
- whether or not the add the object to the parent.public void setAddAction(AddAction addAction)
addAction
- the current AddAction should be.public void setDoProcessChildren(boolean b)
b
- whether or not the process further down the DOM hierachy.public void handleException(String msg, Exception ex) throws CookXmlException
handleException
in interface ExceptionHandler
msg
- the message for the exceptionex
- the exception to be handled
CookXmlException
- if an error cannot be handledpublic Object setProperty(String key, Object value)
key
- key of the property entryvalue
- value of the property entry
public Object getProperty(String key)
key
- key of the property entry
public void addCleanupHook(CleanupHook hook)
hook
- the CleanupHook to be added.public void removeCleanupHook(CleanupHook hook)
hook
- the CleanupHook to be remove.public void cleanup() throws CleanupException
CleanupException
- This exception is thrown when one of the CleanupHook encountered an error.public String getPrefixNameSpace(String prefix)
prefix
- the namespace prefix.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |