Top Description Inners Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.reflect

public abstract Class TransducedAccessor<BeanT>

extends Object
Class Inheritance
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeTransducedAccessorImpl, org.glassfish.jaxb.runtime.v2.runtime.reflect.DefaultTransducedAccessor
Imports
com.sun.istack.NotNull, .Nullable, .SAXException2, org.glassfish.jaxb.core.WhiteSpaceProcessor, org.glassfish.jaxb.runtime.api.AccessorException, org.glassfish.jaxb.core.v2.model.core.ID, org.glassfish.jaxb.runtime.v2.model.impl.RuntimeModelBuilder, org.glassfish.jaxb.runtime.v2.model.runtime.RuntimeNonElementRef, .RuntimePropertyInfo, org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl, .Name, .Transducer, .XMLSerializer, org.glassfish.jaxb.core.v2.runtime.unmarshaller.LocatorEx, org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Patcher, .UnmarshallingContext, jakarta.xml.bind.JAXBException, jakarta.xml.bind.annotation.XmlValue, org.xml.sax.SAXException, javax.xml.stream.XMLStreamException, java.io.IOException, java.util.concurrent.Callable

Accessor and Transducer combined into one object.

This allows efficient conversions between primitive values and String without using boxing.

This abstraction only works for a single-value property.

An instance of TransducedAccessor implicitly holds a field of the BeanT that the accessors access.

Author
Kohsuke Kawaguchi ([email protected])

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
public static class
TransducedAccessor.CompositeTransducedAccessorImpl<BeanT, ValueT>

Implementation of TransducedAccessor that simply combines a Transducer and Accessor.

private static class

Constructor Summary

AccessConstructor and Description
protected
TransducedAccessor()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
declareNamespace(BeanT o, XMLSerializer w)

Obtain the value of the field and declares the namespace URIs used in the value.

public static <T> TransducedAccessor<T>
get(JAXBContextImpl context, RuntimeNonElementRef ref)

Gets the appropriately configured for the given property.

public abstract boolean
hasValue(BeanT o)

Checks if the field has a value.

public abstract void
parse(BeanT o, CharSequence lexical)

Parses the text value into the responsible field of the given bean.

public boolean
public abstract void
writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName)

Convenience method to write the value as a text inside an element without any attributes.

public abstract void
writeText(XMLSerializer w, BeanT o, String fieldName)

Invokes one of the XMLSerializer#text(String, String) method with the representation of data bested suited for this transduced accessor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TransducedAccessorback to summary
protected TransducedAccessor()

Default constructor.

Method Detail

declareNamespaceback to summary
public void declareNamespace(BeanT o, XMLSerializer w) throws AccessorException, SAXException

Obtain the value of the field and declares the namespace URIs used in the value.

See Also
Transducer#declareNamespace(Object, XMLSerializer)
getback to summary
public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref)

Gets the appropriately configured for the given property.

This allows the implementation to use an optimized code.

hasValueback to summary
public abstract boolean hasValue(BeanT o) throws AccessorException

Checks if the field has a value.

parseback to summary
public abstract void parse(BeanT o, CharSequence lexical) throws AccessorException, SAXException

Parses the text value into the responsible field of the given bean.

Use UnmarshallingContext#getInstance() to access to the namespace bindings

Exceptions
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 parse method found an error, the error is reported, and then the processing is aborted.
RuntimeException:
if the lexical form is incorrect. The method may throw a RuntimeException, but it shouldn't cause the entire unmarshalling to fail.
useNamespaceback to summary
public boolean useNamespace()
See Also
Transducer#useNamespace()
writeLeafElementback to summary
public abstract void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException

Convenience method to write the value as a text inside an element without any attributes. Can be overridden for improved performance.

The callee assumes that there's an associated value in the field. No @xsi:type handling is expected.

writeTextback to summary
public abstract void writeText(XMLSerializer w, BeanT o, String fieldName) throws AccessorException, SAXException, IOException, XMLStreamException

Invokes one of the XMLSerializer#text(String, String) method with the representation of data bested suited for this transduced accessor.

org.glassfish.jaxb.runtime.v2.runtime.reflect back to summary

pack-priv Class TransducedAccessor.CompositeContextDependentTransducedAccessorImpl<BeanT, ValueT>

extends TransducedAccessor.CompositeTransducedAccessorImpl<BeanT, ValueT>
Class Inheritance

Field Summary

Inherited from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeTransducedAccessorImpl:
accxducer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
declareNamespace(BeanT bean, XMLSerializer w)

Overrides org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.declareNamespace.

Obtain the value of the field and declares the namespace URIs used in the value.

public boolean
public void
writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName)

Overrides org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeTransducedAccessorImpl.writeLeafElement.

Convenience method to write the value as a text inside an element without any attributes.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeTransducedAccessorImpl:
hasValueparseprintwriteText

Constructor Detail

CompositeContextDependentTransducedAccessorImplback to summary
public CompositeContextDependentTransducedAccessorImpl(JAXBContextImpl context, Transducer<ValueT> xducer, Accessor<BeanT, ValueT> acc)

Method Detail

declareNamespaceback to summary
public void declareNamespace(BeanT bean, XMLSerializer w) throws AccessorException

Overrides org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.declareNamespace.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.declareNamespace.

Obtain the value of the field and declares the namespace URIs used in the value.

Annotations
@Override
useNamespaceback to summary
public boolean useNamespace()

Overrides org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.useNamespace.

Annotations
@Override
writeLeafElementback to summary
public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException

Overrides org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeTransducedAccessorImpl.writeLeafElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeLeafElement.

Convenience method to write the value as a text inside an element without any attributes. Can be overridden for improved performance.

The callee assumes that there's an associated value in the field. No @xsi:type handling is expected.

Annotations
@Override
org.glassfish.jaxb.runtime.v2.runtime.reflect back to summary

public Class TransducedAccessor.CompositeTransducedAccessorImpl<BeanT, ValueT>

extends TransducedAccessor<BeanT>
Class Inheritance
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.CompositeContextDependentTransducedAccessorImpl

Implementation of TransducedAccessor that simply combines a Transducer and Accessor.

Field Summary

Modifier and TypeField and Description
protected final Accessor<BeanT, ValueT>
protected final Transducer<ValueT>

Constructor Summary

AccessConstructor and Description
public
CompositeTransducedAccessorImpl(JAXBContextImpl context, Transducer<ValueT> xducer, Accessor<BeanT, ValueT> acc)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasValue(BeanT bean)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Checks if the field has a value.

public void
parse(BeanT bean, CharSequence lexical)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Parses the text value into the responsible field of the given bean.

public CharSequence
print(BeanT bean)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.print.

Prints the responsible field of the given bean to the writer.

public void
writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeLeafElement.

Convenience method to write the value as a text inside an element without any attributes.

public void
writeText(XMLSerializer w, BeanT o, String fieldName)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeText.

Invokes one of the XMLSerializer#text(String, String) method with the representation of data bested suited for this transduced accessor.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor:
declareNamespacegetuseNamespace

Field Detail

accback to summary
protected final Accessor<BeanT, ValueT> acc
xducerback to summary
protected final Transducer<ValueT> xducer

Constructor Detail

CompositeTransducedAccessorImplback to summary
public CompositeTransducedAccessorImpl(JAXBContextImpl context, Transducer<ValueT> xducer, Accessor<BeanT, ValueT> acc)

Method Detail

hasValueback to summary
public boolean hasValue(BeanT bean) throws AccessorException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Checks if the field has a value.

Annotations
@Override
parseback to summary
public void parse(BeanT bean, CharSequence lexical) throws AccessorException, SAXException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Parses the text value into the responsible field of the given bean.

Use UnmarshallingContext#getInstance() to access to the namespace bindings

Annotations
@Override
Exceptions
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 parse method found an error, the error is reported, and then the processing is aborted.
printback to summary
public CharSequence print(BeanT bean) throws AccessorException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.print.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.print.

Prints the responsible field of the given bean to the writer.

Use XMLSerializer#getInstance() to access to the namespace bindings

Annotations
@Override
writeLeafElementback to summary
public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeLeafElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeLeafElement.

Convenience method to write the value as a text inside an element without any attributes. Can be overridden for improved performance.

The callee assumes that there's an associated value in the field. No @xsi:type handling is expected.

Annotations
@Override
writeTextback to summary
public void writeText(XMLSerializer w, BeanT o, String fieldName) throws AccessorException, SAXException, IOException, XMLStreamException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeText.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.writeText.

Invokes one of the XMLSerializer#text(String, String) method with the representation of data bested suited for this transduced accessor.

Annotations
@Override
org.glassfish.jaxb.runtime.v2.runtime.reflect back to summary

private final Class TransducedAccessor.IDREFTransducedAccessorImpl<BeanT, TargetT>

extends DefaultTransducedAccessor<BeanT>
Class Inheritance

TransducedAccessor for IDREF. BeanT: the type of the bean that contains this the IDREF field. TargetT: the type of the bean pointed by IDREF.

Field Summary

Modifier and TypeField and Description
private final Accessor<BeanT, TargetT>
private final Class<TargetT>
targetType

The object that an IDREF resolves to should be assignable to this type.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
assign(BeanT bean, TargetT t, UnmarshallingContext context)

public boolean
hasValue(BeanT bean)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Checks if the field has a value.

public void
parse(final BeanT bean, CharSequence lexical)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Parses the text value into the responsible field of the given bean.

public String
print(BeanT bean)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.DefaultTransducedAccessor.print.

Prints the responsible field of the given bean to the writer.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.reflect.DefaultTransducedAccessor:
writeLeafElementwriteText

Field Detail

accback to summary
private final Accessor<BeanT, TargetT> acc
targetTypeback to summary
private final Class<TargetT> targetType

The object that an IDREF resolves to should be assignable to this type.

Constructor Detail

IDREFTransducedAccessorImplback to summary
public IDREFTransducedAccessorImpl(Accessor<BeanT, TargetT> acc)

Method Detail

assignback to summary
private void assign(BeanT bean, TargetT t, UnmarshallingContext context) throws AccessorException
hasValueback to summary
public boolean hasValue(BeanT bean) throws AccessorException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.hasValue.

Checks if the field has a value.

Annotations
@Override
parseback to summary
public void parse(final BeanT bean, CharSequence lexical) throws AccessorException, SAXException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.parse.

Parses the text value into the responsible field of the given bean.

Use UnmarshallingContext#getInstance() to access to the namespace bindings

Annotations
@Override
Exceptions
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 parse method found an error, the error is reported, and then the processing is aborted.
printback to summary
public String print(BeanT bean) throws AccessorException, SAXException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.reflect.DefaultTransducedAccessor.print.

Doc from org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor.print.

Prints the responsible field of the given bean to the writer.

Use XMLSerializer#getInstance() to access to the namespace bindings

Annotations
@Override