Package com.sun.xml.bind.v2.runtime
Class FilterTransducer<T>
java.lang.Object
com.sun.xml.bind.v2.runtime.FilterTransducer<T>
- All Implemented Interfaces:
Transducer<T>
- Direct Known Subclasses:
InlineBinaryTransducer
,MimeTypedTransducer
,SchemaTypeTransducer
Transducer
that delegates to another Transducer
.- Author:
- Kohsuke Kawaguchi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
declareNamespace
(T o, XMLSerializer w) Declares the namespace URIs used in the given value tow
.getTypeName
(T instance) Transducers implicitly work against a single XML type, but sometimes (most notablyXMLGregorianCalendar
, an instance may choose different XML types.parse
(CharSequence lexical) Converts the lexical representation to a value object.Converts the given value to its lexical representation.boolean
If true, thisTransducer
doesn't declare any namespace, and thereforeTransducer.declareNamespace(Object, XMLSerializer)
is no-op.void
writeLeafElement
(XMLSerializer w, Name tagName, T o, String fieldName) Sends the result of theTransducer.print(Object)
operation to one of theXMLSerializer.leafElement(Name, String, String)
method.void
writeText
(XMLSerializer w, T o, String fieldName) Sends the result of theTransducer.print(Object)
operation to one of theXMLSerializer.text(String, String)
method, but with the best representation of the value, not necessarily String.
-
Field Details
-
core
-
-
Constructor Details
-
FilterTransducer
-
-
Method Details
-
useNamespace
public boolean useNamespace()Description copied from interface:Transducer
If true, thisTransducer
doesn't declare any namespace, and thereforeTransducer.declareNamespace(Object, XMLSerializer)
is no-op. It also means that theTransducer.parse(CharSequence)
method won't use the context parameter.- Specified by:
useNamespace
in interfaceTransducer<T>
-
declareNamespace
Description copied from interface:Transducer
Declares the namespace URIs used in the given value tow
.- Specified by:
declareNamespace
in interfaceTransducer<T>
- Parameters:
o
- never be null.w
- may be null if!{@link #useNamespace()}
.- Throws:
AccessorException
-
print
Description copied from interface:Transducer
Converts the given value to its lexical representation.- Specified by:
print
in interfaceTransducer<T>
- Parameters:
o
- never be null.- Returns:
- always non-null valid lexical representation.
- Throws:
AccessorException
-
parse
Description copied from interface:Transducer
Converts the lexical representation to a value object.- Specified by:
parse
in interfaceTransducer<T>
- Parameters:
lexical
- never be null.- Throws:
AccessorException
- if the transducer is used to parse an user bean that usesXmlValue
, 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.)
-
writeText
public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException Description copied from interface:Transducer
Sends the result of theTransducer.print(Object)
operation to one of theXMLSerializer.text(String, String)
method, but with the best representation of the value, not necessarily String.- Specified by:
writeText
in interfaceTransducer<T>
- Throws:
IOException
SAXException
XMLStreamException
AccessorException
-
writeLeafElement
public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException Description copied from interface:Transducer
Sends the result of theTransducer.print(Object)
operation to one of theXMLSerializer.leafElement(Name, String, String)
method. but with the best representation of the value, not necessarily String.- Specified by:
writeLeafElement
in interfaceTransducer<T>
- Throws:
IOException
SAXException
XMLStreamException
AccessorException
-
getTypeName
Description copied from interface:Transducer
Transducers implicitly work against a single XML type, but sometimes (most notablyXMLGregorianCalendar
, an instance may choose different XML types.- Specified by:
getTypeName
in interfaceTransducer<T>
- 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.
-