com.sun.xml.bind.v2.runtime
Class FilterTransducer<T>

java.lang.Object
  extended by com.sun.xml.bind.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>

Transducer that delegates to another Transducer.


Field Summary
protected  Transducer<T> core
           
 
Constructor Summary
protected FilterTransducer(Transducer<T> core)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

core

protected final Transducer<T> core
Constructor Detail

FilterTransducer

protected FilterTransducer(Transducer<T> core)
Method Detail

isDefault

public final boolean isDefault()
Description copied from interface: Transducer
If this Transducer is the default transducer for the ValueT, this method returns true. Used exclusively by OptimizedTransducedAccessorFactory.get(RuntimePropertyInfo)

Specified by:
isDefault in interface Transducer<T>

useNamespace

public boolean useNamespace()
Description copied from interface: Transducer
If true, this Transducer 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.

Specified by:
useNamespace in interface Transducer<T>

declareNamespace

public void declareNamespace(T o,
                             XMLSerializer w)
                      throws AccessorException
Description copied from interface: Transducer
Declares the namespace URIs used in the given value to w.

Specified by:
declareNamespace in interface Transducer<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: Transducer
Converts the given value to its lexical representation.

Specified by:
print in interface Transducer<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: Transducer
Converts the lexical representation to a value object.

Specified by:
parse in interface Transducer<T>
Parameters:
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.)

writeText

public void writeText(XMLSerializer w,
                      T o,
                      String fieldName)
               throws IOException,
                      SAXException,
                      javax.xml.stream.XMLStreamException,
                      AccessorException
Description copied from interface: Transducer
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.

Specified by:
writeText in interface Transducer<T>
Throws:
IOException
SAXException
javax.xml.stream.XMLStreamException
AccessorException

writeLeafElement

public void writeLeafElement(XMLSerializer w,
                             Name tagName,
                             T o,
                             String fieldName)
                      throws IOException,
                             SAXException,
                             javax.xml.stream.XMLStreamException,
                             AccessorException
Description copied from interface: Transducer
Sends the result of the Transducer.print(Object) operation to one of the XMLSerializer.leafElement(Name, String, String) method. but with the best representation of the value, not necessarily String.

Specified by:
writeLeafElement in interface Transducer<T>
Throws:
IOException
SAXException
javax.xml.stream.XMLStreamException
AccessorException

getTypeName

public QName getTypeName(T instance)
Description copied from interface: Transducer
Transducers implicitly work against a single XML type, but sometimes (most notably XMLGregorianCalendar, an instance may choose different XML types.

Specified by:
getTypeName in interface Transducer<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.