Package com.luciad.format.xml
Class ALcdXMLVisitorBasedElementAdapter
java.lang.Object
com.luciad.format.xml.ALcdXMLVisitorBasedElementAdapter
- All Implemented Interfaces:
ILcdXMLElementAdapter
- Direct Known Subclasses:
ALcdXMLTypedVisitorBasedElementAdapter
,TLcdXMLDefaultElementAdapter
public abstract class ALcdXMLVisitorBasedElementAdapter
extends Object
implements ILcdXMLElementAdapter
Deprecated.
An abstract class implementing
ILcdXMLElementAdapter
, facilitating
the implementation of custom XML adapters.
Typically, when extending this class, the following methods need to be overwritten:
- when adding attributes:
- visitAttributes()
- when adding contents:
- visitContents()
ILcdXMLElementAdapter
interface are implemented by this adapter using delegation to the visit...() methods. These methods
should normally not be overwritten.
This adapter is considered as the default (non-typed) element adapter class to extend from,
offering an easy and compact implementation, and excellent serial access performance.-
Constructor Summary
ConstructorDescriptionALcdXMLVisitorBasedElementAdapter
(ILcdXMLElementAdapterProvider aElementAdapterProvider, ILcdXMLElementNameProvider aElementNameProvider) Deprecated.Constructs a newALcdXMLElementAdapter
, initialized with the specifiedILcdXMLElementAdapterProvider
andILcdXMLElementNameProvider
.ALcdXMLVisitorBasedElementAdapter
(ILcdXMLElementAdapterProvider aElementAdapterProvider, TLcdXMLName aElementName) Deprecated.Constructs a newALcdXMLElementAdapter
, initialized with the specifiedILcdXMLElementAdapterProvider
and a fixed element name. -
Method Summary
Modifier and TypeMethodDescriptionint
getAttributeCount
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack) Deprecated.Inspects the object on top of the name/object stack: returns the number of attributes, contained in the inspected object.getAttributeName
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the name of the attribute at the given index.getAttributeValue
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the value of the attribute at the given index.getAttributeValue
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aAttributeName) Deprecated.Inspects the object on top of the name/object stack: returns the value of the attribute with the specified name, ornull
if no such attribute exists.getAttributeValueAsString
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the value of the attribute at the given index, as a String.getAttributeValueAsString
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aAttributeName) Deprecated.Inspects the object on top of the name/object stack: returns the value of the attribute with the specified name, as a String.getContent
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the content, at the given index.getContent
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.The default implementation iterates over all contents, and counts the number of elements having the provided XML name, to retrieve the content at positionaIndex
.getContentAdapter
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns a suitableILcdXMLElementAdapter
for the content at the given index.getContentAdapter
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.Returns an XML adapter for the content at the specified index in the list of contents having the specified XML name.getContentAsString
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the content, at the given index, as a String.getContentAsString
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.Returns thetoString()
value of the Object returned bygetContent()
.int
getContentCount
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack) Deprecated.Inspects the object on top of the name/object stack: returns the number of contents, contained in the inspected object.int
getContentCount
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName) Deprecated.The default implementation iterates over all contents, and counts the number of elements having the provided XML name.getContentName
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returns the name of the content at the given index.protected ILcdXMLElementAdapterProvider
Deprecated.Returns theILcdXMLElementAdapterProvider
from which child adapters are retrieved.protected ILcdXMLElementNameProvider
Deprecated.Returns theILcdXMLElementNameProvider
which is used to retrieve XML names.getName
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aSubstitutionGroup, Object aObject) Deprecated.Returns the name of the object specified by the given name/object stack, substitution group and object.boolean
isPrimitiveContent
(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Inspects the object on top of the name/object stack: returnstrue
if the content at the given index is primitive content (i.e., no XML element),false
otherwise.void
visitAttributes
(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) Deprecated.Visits the attributes of the element, specified by the given name and object stack .protected void
visitContent
(ILcdXMLEditableNameStack aParentElementNameStack, ILcdXMLEditableObjectStack aParentObjectStack, TLcdXMLName aName, Object aContent, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) Deprecated.Convenience method that can be called from thevisitContents()
method, to process one child content.void
visitContents
(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) Deprecated.Visits the contents of the element, specified by the given name and object stack .void
visitElement
(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, TLcdXMLName aSubstitutionGroup, Object aObject, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) Deprecated.Visits the given element.
-
Constructor Details
-
ALcdXMLVisitorBasedElementAdapter
public ALcdXMLVisitorBasedElementAdapter(ILcdXMLElementAdapterProvider aElementAdapterProvider, ILcdXMLElementNameProvider aElementNameProvider) Deprecated.Constructs a newALcdXMLElementAdapter
, initialized with the specifiedILcdXMLElementAdapterProvider
andILcdXMLElementNameProvider
.- Parameters:
aElementAdapterProvider
- theILcdXMLElementAdapterProvider
to be used for retrieving child adapters.aElementNameProvider
- theILcdXMLElementNameProvider
to be used for retrieving element names.
-
ALcdXMLVisitorBasedElementAdapter
public ALcdXMLVisitorBasedElementAdapter(ILcdXMLElementAdapterProvider aElementAdapterProvider, TLcdXMLName aElementName) Deprecated.Constructs a newALcdXMLElementAdapter
, initialized with the specifiedILcdXMLElementAdapterProvider
and a fixed element name.- Parameters:
aElementAdapterProvider
- theILcdXMLElementAdapterProvider
to be used for retrieving child adapters.aElementName
- the name of the element handled by this adapter.
-
-
Method Details
-
getName
public TLcdXMLName getName(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aSubstitutionGroup, Object aObject) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Returns the name of the object specified by the given name/object stack, substitution group and object.- Specified by:
getName
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aSubstitutionGroup
- the substitution group the returned element should belong to, if there is one (null
otherwise).aObject
- the element for which to return a name.- Returns:
- the element name that best matches the specified element.
-
getAttributeName
public TLcdXMLName getAttributeName(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the name of the attribute at the given index.- Specified by:
getAttributeName
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the attribute whose name is to be returned.- Returns:
- the name of the attribute with the given index.
-
getAttributeValue
public Object getAttributeValue(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the value of the attribute at the given index.- Specified by:
getAttributeValue
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the attribute whose value is to be returned.- Returns:
- the value of the attribute with the given index.
-
getAttributeValueAsString
public String getAttributeValueAsString(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the value of the attribute at the given index, as a String.- Specified by:
getAttributeValueAsString
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
- the value of the attribute with the given index, as a String.
-
getAttributeCount
Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the number of attributes, contained in the inspected object.- Specified by:
getAttributeCount
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.- Returns:
- the number of attributes for the object on top of the name/object stack.
-
getAttributeValue
public Object getAttributeValue(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aAttributeName) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the value of the attribute with the specified name, ornull
if no such attribute exists.- Specified by:
getAttributeValue
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aAttributeName
- the name of the attribute for which to return a value.- Returns:
- the value of the attribute with the specified name.
-
getAttributeValueAsString
public String getAttributeValueAsString(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aAttributeName) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the value of the attribute with the specified name, as a String.- Specified by:
getAttributeValueAsString
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aAttributeName
- the name of the attribute for which to return a value.- Returns:
- the value of the attribute with the given index, as a String.
-
getContentName
public TLcdXMLName getContentName(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the name of the content at the given index. In general, this method should be implemented as follows:- if the type of the current object enforces the child content at the given index to
have a fixed name (e.g.
<element name="xxx" type="yyy"/>
), this name can be returned immediately. - if the type of the current object enforces the child content at the given index to
belong to a certain substitution group (e.g.
<element ref="zzz">
), the child adapter should be retrieved, and the call should be forwarded to thegetName()
method of the child adapter, with the given substitution group. - if nothing is known about the child content, the child adapter should be retrieved, and
the call should be forwared to the
getName()
method of the child adapter, with thenull
argument as substitution group.
- Specified by:
getContentName
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
- the name of the content with the given index.
- if the type of the current object enforces the child content at the given index to
have a fixed name (e.g.
-
getContent
Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the content, at the given index.- Specified by:
getContent
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
- the content with the given index.
-
getContentAsString
public String getContentAsString(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the content, at the given index, as a String.- Specified by:
getContentAsString
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
- the content with the given index, as a String.
-
getContentAdapter
public ILcdXMLElementAdapter getContentAdapter(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns a suitableILcdXMLElementAdapter
for the content at the given index.- Specified by:
getContentAdapter
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
- a suitable adapter for the content at the given index.
-
isPrimitiveContent
public boolean isPrimitiveContent(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, int aIndex) Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returnstrue
if the content at the given index is primitive content (i.e., no XML element),false
otherwise.- Specified by:
isPrimitiveContent
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.aIndex
- the index of the content whose name is to be returned.- Returns:
true
if the content at the given index is primitive content,false
otherwise.
-
getContentCount
Deprecated.Description copied from interface:ILcdXMLElementAdapter
Inspects the object on top of the name/object stack: returns the number of contents, contained in the inspected object.- Specified by:
getContentCount
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be inspected.aObjectStack
- the XML object stack, identifying the XML element to be inspected.- Returns:
- the number of contents for the object on top of the name/object stack.
-
getContentCount
public int getContentCount(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName) Deprecated.The default implementation iterates over all contents, and counts the number of elements having the provided XML name.- Specified by:
getContentCount
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
-aObjectStack
-aXMLName
-- Returns:
- the number of contents for the object on top of the name/object stack.
-
getContent
public Object getContent(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.The default implementation iterates over all contents, and counts the number of elements having the provided XML name, to retrieve the content at positionaIndex
.- Specified by:
getContent
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
-aObjectStack
-aXMLName
-aIndex
-- Returns:
- the content with the given index.
-
getContentAsString
public String getContentAsString(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.Returns thetoString()
value of the Object returned bygetContent()
.- Specified by:
getContentAsString
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
-aObjectStack
-aXMLName
- the name of the content to be returned.aIndex
-- Returns:
getContent(aNameStack, aObjectStack, aXMLName, aIndex).toString()
-
getContentAdapter
public ILcdXMLElementAdapter getContentAdapter(ILcdXMLNameStack aNameStack, ILcdXMLObjectStack aObjectStack, TLcdXMLName aXMLName, int aIndex) Deprecated.Returns an XML adapter for the content at the specified index in the list of contents having the specified XML name. The implementation will delegate the request to theILcdXMLElementAdapterProvider
that was provided at construction time.- Specified by:
getContentAdapter
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
-aObjectStack
-aXMLName
- the name of the content for which to return an adapter.aIndex
-- Returns:
- a suitable adapter for the content at the given index.
-
visitElement
public void visitElement(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, TLcdXMLName aSubstitutionGroup, Object aObject, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) throws TLcdXMLInterruptedException Deprecated.Description copied from interface:ILcdXMLElementAdapter
Visits the given element. The element to be visited is specified by a name and object stack, containing the XML stack up to the parent name/object, and a (name,object) pair. TheILcdXMLElementVisitor
interface documentation contains a detailed description of how an XML element needs to be visited.- Specified by:
visitElement
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be visited.aObjectStack
- the XML object stack, identifying the XML element to be visited.aSubstitutionGroup
- the element name or substitution group of the element to be visitedaObject
- the lement to be visitedaElementVisitor
- the element visitor which is called by this visitable.aDocumentContext
- the XML document context- Throws:
TLcdXMLInterruptedException
- if the visit action has been interrupted.- See Also:
-
visitAttributes
public void visitAttributes(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) throws TLcdXMLInterruptedException Deprecated.Description copied from interface:ILcdXMLElementAdapter
Visits the attributes of the element, specified by the given name and object stack .- Specified by:
visitAttributes
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be visited.aObjectStack
- the XML object stack, identifying the XML element to be visited.aElementVisitor
- the element visitor which is called by this visitable.aDocumentContext
- the XML document context- Throws:
TLcdXMLInterruptedException
- if the visit action has been interrupted.- See Also:
-
visitContents
public void visitContents(ILcdXMLEditableNameStack aNameStack, ILcdXMLEditableObjectStack aObjectStack, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) throws TLcdXMLInterruptedException Deprecated.Description copied from interface:ILcdXMLElementAdapter
Visits the contents of the element, specified by the given name and object stack .- Specified by:
visitContents
in interfaceILcdXMLElementAdapter
- Parameters:
aNameStack
- the XML name stack, identifying the XML element to be visited.aObjectStack
- the XML object stack, identifying the XML element to be visited.aElementVisitor
- the element visitor which is called by this visitable.aDocumentContext
- the XML document context- Throws:
TLcdXMLInterruptedException
- if the visit action has been interrupted.- See Also:
-
visitContent
protected void visitContent(ILcdXMLEditableNameStack aParentElementNameStack, ILcdXMLEditableObjectStack aParentObjectStack, TLcdXMLName aName, Object aContent, ILcdXMLElementVisitor aElementVisitor, ILcdXMLDocumentContext aDocumentContext) throws TLcdXMLInterruptedException Deprecated.Convenience method that can be called from thevisitContents()
method, to process one child content. When called, an adapter will be retrieved from the element adapter provider, and, if it is notnull
, the child adapter'svisitElement()
method will be called with all parameters passed to this method.- Parameters:
aParentElementNameStack
-aParentObjectStack
-aName
-aContent
-aElementVisitor
-aDocumentContext
-- Throws:
TLcdXMLInterruptedException
-
getElementAdapterProvider
Deprecated.Returns theILcdXMLElementAdapterProvider
from which child adapters are retrieved.- Returns:
- the
ILcdXMLElementAdapterProvider
from which child adapters are retrieved.
-
getElementNameProvider
Deprecated.Returns theILcdXMLElementNameProvider
which is used to retrieve XML names.- Returns:
- the
ILcdXMLElementNameProvider
which is used to retrieve XML names.
-
com.format.xml
API has been deprecated. Instead, use thecom.format.xml.bind
API.