com.sun.xml.bind.v2.runtime
public interface Transducer<ValueT>
An implementation of this interface hides how this conversion happens.
Transducers are immutable.
Method Summary | |
---|---|
void | declareNamespace(ValueT o, XMLSerializer w)
Declares the namespace URIs used in the given value to {@code 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 is no-op.
|
void | writeLeafElement(XMLSerializer w, Name tagName, ValueT o, String fieldName)
Sends the result of the Transducer operation
to one of the XMLSerializer method.
but with the best representation of the value, not necessarily String. |
void | writeText(XMLSerializer w, ValueT o, String fieldName)
Sends the result of the Transducer operation
to one of the XMLSerializer method,
but with the best representation of the value, not necessarily String. |
Parameters: o never be null. w may be null if {@code !useNamespace}.
Returns: return non-null from this method allows transducers to specify the type it wants to marshal to. Most of the time this method returns null, in which case the implicitly associated type will be used.
ValueT
,
this method returns true.
Used exclusively by getParameters: 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. SAXException if the lexical form is incorrect, the error should be reported and SAXException may thrown (or it can return null to recover.)
Parameters: o never be null.
Returns: always non-null valid lexical representation.