FilterTransducer
, InlineBinaryTransducer
, MimeTypedTransducer
, RuntimeBuiltinLeafInfoImpl
, SchemaTypeTransducer
public interface Transducer<ValueT>
An implementation of this interface hides how this conversion happens.
Transducer
s are immutable.
Modifier and Type | Method | Description |
---|---|---|
void |
declareNamespace(ValueT o,
XMLSerializer w) |
Declares the namespace URIs used in the given value to
w . |
javax.xml.namespace.QName |
getTypeName(ValueT instance) |
Transducers implicitly work against a single XML type,
but sometimes (most notably
XMLGregorianCalendar ,
an instance may choose different XML types. |
ValueT |
parse(java.lang.CharSequence lexical) |
Converts the lexical representation to a value object.
|
java.lang.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 declareNamespace(Object, XMLSerializer) is no-op. |
void |
writeLeafElement(XMLSerializer w,
Name tagName,
ValueT o,
java.lang.String fieldName) |
Sends the result of the
print(Object) operation
to one of the XMLSerializer.leafElement(Name, String, String) method. |
void |
writeText(XMLSerializer w,
ValueT o,
java.lang.String fieldName) |
Sends the result of the
print(Object) operation
to one of the XMLSerializer.text(String, String) method,
but with the best representation of the value, not necessarily String. |
boolean useNamespace()
Transducer
doesn't declare any namespace,
and therefore declareNamespace(Object, XMLSerializer)
is no-op.
It also means that the parse(CharSequence)
method
won't use the context parameter.void declareNamespace(ValueT o, XMLSerializer w) throws AccessorException
w
.o
- never be null.w
- may be null if !{@link #useNamespace()}
.AccessorException
@NotNull java.lang.CharSequence print(@NotNull ValueT o) throws AccessorException
o
- never be null.AccessorException
ValueT parse(java.lang.CharSequence lexical) throws AccessorException, org.xml.sax.SAXException
lexical
- never be null.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.org.xml.sax.SAXException
- if the lexical form is incorrect, the error should be reported
and SAXException may thrown (or it can return null to recover.)void writeText(XMLSerializer w, ValueT o, java.lang.String fieldName) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.stream.XMLStreamException, AccessorException
print(Object)
operation
to one of the XMLSerializer.text(String, String)
method,
but with the best representation of the value, not necessarily String.java.io.IOException
org.xml.sax.SAXException
javax.xml.stream.XMLStreamException
AccessorException
void writeLeafElement(XMLSerializer w, Name tagName, @NotNull ValueT o, java.lang.String fieldName) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.stream.XMLStreamException, AccessorException
print(Object)
operation
to one of the XMLSerializer.leafElement(Name, String, String)
method.
but with the best representation of the value, not necessarily String.java.io.IOException
org.xml.sax.SAXException
javax.xml.stream.XMLStreamException
AccessorException
javax.xml.namespace.QName getTypeName(@NotNull ValueT instance)
XMLGregorianCalendar
,
an instance may choose different XML types.Copyright © 2018 Oracle Corporation. All rights reserved.