| com.sun.xml.bind.v2.runtime.Transducer
Transducer | public interface Transducer (Code) | | Responsible for converting a Java object to a lexical representation
and vice versa.
An implementation of this interface hides how this conversion happens.
Transducer s are immutable.
author: Kohsuke Kawaguchi (kk@kohsuke.org) |
Method Summary | |
void | declareNamespace(ValueT o, XMLSerializer w) Declares the namespace URIs used in the given value to
w . | QName | getTypeName(ValueT instance) Transducers implicitly work against a single XML type,
but sometimes (most notably
XMLGregorianCalendar ,
an instance may choose different XML types. | boolean | isDefault() If this
Transducer is the default transducer for the ValueT ,
this method returns true. | ValueT | parse(CharSequence lexical) Converts the lexical representation to a value object. | CharSequence | print(ValueT o) Converts the given value to its lexical representation. | boolean | useNamespace() If true, this
Transducer doesn't declare any namespace,
and therefore
Transducer.declareNamespace(Object,XMLSerializer) is no-op. | void | writeLeafElement(XMLSerializer w, Name tagName, ValueT o, String fieldName) Sends the result of the
Transducer.print(Object) operation
to one of the
XMLSerializer.leafElement(NameStringString) method. | void | writeText(XMLSerializer w, ValueT o, String fieldName) Sends the result of the
Transducer.print(Object) operation
to one of the
XMLSerializer.text(StringString) method,
but with the best representation of the value, not necessarily String. |
getTypeName | QName getTypeName(ValueT instance)(Code) | | Transducers implicitly work against a single XML type,
but sometimes (most notably
XMLGregorianCalendar ,
an instance may choose different XML types.
return non-null from this method allows transducersto specify the type it wants to marshal to.Most of the time this method returns null, in which casethe implicitly associated type will be used. |
parse | ValueT parse(CharSequence lexical) throws AccessorException, SAXException(Code) | | Converts the lexical representation to a value object.
Parameters: lexical - never be null. throws: AccessorException - if the transducer is used to parse an user bean that uses XmlValue,then this exception may occur when it tries to set the leaf value to the bean. throws: SAXException - if the lexical form is incorrect, the error should be reportedand SAXException may thrown (or it can return null to recover.) |
print | CharSequence print(ValueT o) throws AccessorException(Code) | | Converts the given value to its lexical representation.
Parameters: o - never be null.always non-null valid lexical representation. |
|
|