public abstract class FilterTransducer<T> extends Object implements Transducer<T>
Transducer that delegates to another Transducer.| Modifier and Type | Field and Description |
|---|---|
protected Transducer<T> |
core |
| Modifier | Constructor and Description |
|---|---|
protected |
FilterTransducer(Transducer<T> core) |
| Modifier and Type | Method and Description |
|---|---|
void |
declareNamespace(T o,
XMLSerializer w)
Declares the namespace URIs used in the given value to
w. |
QName |
getTypeName(T 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. |
T |
parse(CharSequence lexical)
Converts the lexical representation to a value object.
|
CharSequence |
print(T 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,
T o,
String fieldName)
Sends the result of the
Transducer.print(Object) operation
to one of the XMLSerializer.leafElement(Name, String, String) method. |
void |
writeText(XMLSerializer w,
T o,
String fieldName)
Sends the result of the
Transducer.print(Object) operation
to one of the XMLSerializer.text(String, String) method,
but with the best representation of the value, not necessarily String. |
protected final Transducer<T> core
protected FilterTransducer(Transducer<T> core)
public final boolean isDefault()
TransducerTransducer is the default transducer for the ValueT,
this method returns true.
Used exclusively by OptimizedTransducedAccessorFactory.get(RuntimePropertyInfo)isDefault in interface Transducer<T>public boolean useNamespace()
TransducerTransducer doesn't declare any namespace,
and therefore Transducer.declareNamespace(Object, XMLSerializer) is no-op.
It also means that the Transducer.parse(CharSequence) method
won't use the context parameter.useNamespace in interface Transducer<T>public void declareNamespace(T o, XMLSerializer w) throws AccessorException
Transducerw.declareNamespace in interface Transducer<T>o - never be null.w - may be null if !{@link #useNamespace()}.AccessorException@NotNull public CharSequence print(@NotNull T o) throws AccessorException
Transducerprint in interface Transducer<T>o - never be null.AccessorExceptionpublic T parse(CharSequence lexical) throws AccessorException, SAXException
Transducerparse in interface Transducer<T>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.SAXException - if the lexical form is incorrect, the error should be reported
and SAXException may thrown (or it can return null to recover.)public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException
TransducerTransducer.print(Object) operation
to one of the XMLSerializer.text(String, String) method,
but with the best representation of the value, not necessarily String.writeText in interface Transducer<T>IOExceptionSAXExceptionXMLStreamExceptionAccessorExceptionpublic void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException
TransducerTransducer.print(Object) operation
to one of the XMLSerializer.leafElement(Name, String, String) method.
but with the best representation of the value, not necessarily String.writeLeafElement in interface Transducer<T>IOExceptionSAXExceptionXMLStreamExceptionAccessorExceptionpublic QName getTypeName(T instance)
TransducerXMLGregorianCalendar,
an instance may choose different XML types.getTypeName in interface Transducer<T>Copyright © 2018 JBoss by Red Hat. All rights reserved.