| java.lang.Object org.jibx.extras.BindingSelector
BindingSelector | public class BindingSelector (Code) | | Binding selector that supports versioned XML documents. This looks for a
version attribute on the root element of the document, and selects the
mapping to be used for unmarshalling based on the value. It also supports
selecting the version for marshalling based on a supplied version argument
value.
author: Dennis M. Sosnoski version: 1.0 |
BindingSelector | public BindingSelector(String uri, String name, String[] versions, String[] bindings)(Code) | | Constructor.
Parameters: uri - version selection attribute URI (null if none) Parameters: name - version selection attribute name Parameters: versions - array of version texts (first is default) Parameters: bindings - array of binding names corresponding to versions |
getContext | public IUnmarshallingContext getContext()(Code) | | Get initial unmarshalling context. This gives access to the unmarshalling
context used before the specific version is determined. The document
information must be set for this context before calling
BindingSelector.unmarshalVersioned .
initial unmarshalling context |
marshalVersioned | public void marshalVersioned(Object obj, String version) throws JiBXException(Code) | | Marshal according to supplied version.
Parameters: obj - root object to be marshalled Parameters: version - identifier for version to be used in marshalling throws: JiBXException - if error in marshalling |
setIndent | public void setIndent(int indent)(Code) | | Set nesting indent spaces.
Parameters: indent - number of spaces to indent per level, or disableindentation if negative |
setOutput | public void setOutput(OutputStream outs, String enc)(Code) | | Set output stream and encoding.
Parameters: outs - stream for document data output Parameters: enc - document output encoding, or null for default |
setOutput | public void setOutput(Writer outw)(Code) | | Set output writer.
Parameters: outw - writer for document data output |
unmarshalVersioned | public Object unmarshalVersioned(Class clas) throws JiBXException(Code) | | Unmarshal according to document version.
Parameters: clas - expected class mapped to root element of document (used onlyto look up the binding) root object unmarshalled from document throws: JiBXException - if error in unmarshalling |
|
|