- java.lang.Object
-
- org.glassfish.jaxb.runtime.v2.runtime.FilterTransducer<T>
-
- All Implemented Interfaces:
Transducer<T>
- Direct Known Subclasses:
InlineBinaryTransducer,MimeTypedTransducer,SchemaTypeTransducer
public abstract class FilterTransducer<T> extends Object implements Transducer<T>
Transducerthat delegates to anotherTransducer.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected Transducer<T>core
-
Constructor Summary
Constructors Modifier Constructor Description protectedFilterTransducer(Transducer<T> core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeclareNamespace(T o, XMLSerializer w)Declares the namespace URIs used in the given value tow.QNamegetTypeName(T instance)Transducers implicitly work against a single XML type, but sometimes (most notablyXMLGregorianCalendar, an instance may choose different XML types.Tparse(CharSequence lexical)Converts the lexical representation to a value object.CharSequenceprint(T o)Converts the given value to its lexical representation.booleanuseNamespace()If true, thisTransducerdoesn't declare any namespace, and thereforeTransducer.declareNamespace(Object, XMLSerializer)is no-op.voidwriteLeafElement(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.voidwriteText(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 Detail
-
core
protected final Transducer<T> core
-
-
Constructor Detail
-
FilterTransducer
protected FilterTransducer(Transducer<T> core)
-
-
Method Detail
-
useNamespace
public boolean useNamespace()
Description copied from interface:TransducerIf true, thisTransducerdoesn'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:
useNamespacein interfaceTransducer<T>
-
declareNamespace
public void declareNamespace(T o, XMLSerializer w) throws AccessorException
Description copied from interface:TransducerDeclares the namespace URIs used in the given value tow.- Specified by:
declareNamespacein interfaceTransducer<T>- Parameters:
o- never be null.w- may be null if!{@link #useNamespace()}.- Throws:
AccessorException
-
print
@NotNull public CharSequence print(@NotNull T o) throws AccessorException
Description copied from interface:TransducerConverts the given value to its lexical representation.- Specified by:
printin interfaceTransducer<T>- Parameters:
o- never be null.- Returns:
- always non-null valid lexical representation.
- Throws:
AccessorException
-
parse
public T parse(CharSequence lexical) throws AccessorException, SAXException
Description copied from interface:TransducerConverts the lexical representation to a value object.- Specified by:
parsein 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:TransducerSends 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:
writeTextin interfaceTransducer<T>- Throws:
IOExceptionSAXExceptionXMLStreamExceptionAccessorException
-
writeLeafElement
public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException
Description copied from interface:TransducerSends 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:
writeLeafElementin interfaceTransducer<T>- Throws:
IOExceptionSAXExceptionXMLStreamExceptionAccessorException
-
getTypeName
public QName getTypeName(T instance)
Description copied from interface:TransducerTransducers implicitly work against a single XML type, but sometimes (most notablyXMLGregorianCalendar, an instance may choose different XML types.- Specified by:
getTypeNamein 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.
-
-