Top Description Fields Constructors Methods
org.codehaus.stax2.ri.evt

public abstract Class BaseEventImpl

extends Object
implements XMLEvent2
Class Inheritance
All Implemented Interfaces
org.codehaus.stax2.evt.XMLEvent2, javax.xml.stream.events.XMLEvent, javax.xml.stream.XMLStreamConstants
Known Direct Subclasses
org.codehaus.stax2.ri.evt.CharactersEventImpl, org.codehaus.stax2.ri.evt.CommentEventImpl, org.codehaus.stax2.ri.evt.DTDEventImpl, org.codehaus.stax2.ri.evt.EndDocumentEventImpl, org.codehaus.stax2.ri.evt.EndElementEventImpl, org.codehaus.stax2.ri.evt.EntityDeclarationEventImpl, org.codehaus.stax2.ri.evt.EntityReferenceEventImpl, org.codehaus.stax2.ri.evt.NotationDeclarationEventImpl, org.codehaus.stax2.ri.evt.ProcInstrEventImpl, org.codehaus.stax2.ri.evt.StartDocumentEventImpl, org.codehaus.stax2.ri.evt.StartElementEventImpl, org.codehaus.stax2.ri.evt.AttributeEventImpl
Imports
java.io.IOException, .Writer, java.util.Iterator, javax.xml.namespace.QName, javax.xml.stream.*, javax.xml.stream.events.*, org.codehaus.stax2.*, org.codehaus.stax2.evt.XMLEvent2

This abstract base class implements common functionality for Stax2 reference implementation's event API part.
Author
Tatu Saloranta

Field Summary

Modifier and TypeField and Description
protected final Location
mLocation

Location where token started; exact definition may depends on event type.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected static int
addHash(Iterator<?> it, int baseHash)

public Characters
asCharacters()

Implements javax.xml.stream.events.XMLEvent.asCharacters.

Returns this event as Characters, may result in a class cast exception if this event is not Characters.
public EndElement
asEndElement()

Implements javax.xml.stream.events.XMLEvent.asEndElement.

Returns this event as an end element event, may result in a class cast exception if this event is not a end element.
public StartElement
asStartElement()

Implements javax.xml.stream.events.XMLEvent.asStartElement.

Returns this event as a start element event, may result in a class cast exception if this event is not a start element.
public abstract boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Declared abstract to force redefinition by sub-classes
public abstract int
getEventType()

Redeclares javax.xml.stream.events.XMLEvent.getEventType.

Returns an integer code for this event.
public Location
getLocation()

Implements javax.xml.stream.events.XMLEvent.getLocation.

Return the location of this event.
public QName
getSchemaType()

Implements javax.xml.stream.events.XMLEvent.getSchemaType.

This method is provided for implementations to provide optional type information about the associated event.
public abstract int
hashCode()

Overrides java.lang.Object.hashCode.

Declared abstract to force redefinition by sub-classes
public boolean
isAttribute()

Implements javax.xml.stream.events.XMLEvent.isAttribute.

A utility function to check if this event is an Attribute.
public boolean
isCharacters()

Implements javax.xml.stream.events.XMLEvent.isCharacters.

A utility function to check if this event is Characters.
public boolean
isEndDocument()

Implements javax.xml.stream.events.XMLEvent.isEndDocument.

A utility function to check if this event is an EndDocument.
public boolean
isEndElement()

Implements javax.xml.stream.events.XMLEvent.isEndElement.

A utility function to check if this event is a EndElement.
public boolean
isEntityReference()

Implements javax.xml.stream.events.XMLEvent.isEntityReference.

A utility function to check if this event is an EntityReference.
public boolean
isNamespace()

Implements javax.xml.stream.events.XMLEvent.isNamespace.

A utility function to check if this event is a Namespace.
public boolean
isProcessingInstruction()

Implements javax.xml.stream.events.XMLEvent.isProcessingInstruction.

A utility function to check if this event is a ProcessingInstruction.
public boolean
isStartDocument()

Implements javax.xml.stream.events.XMLEvent.isStartDocument.

A utility function to check if this event is a StartDocument.
public boolean
isStartElement()

Implements javax.xml.stream.events.XMLEvent.isStartElement.

A utility function to check if this event is a StartElement.
protected static boolean
protected static boolean
stringsWithNullsEqual(String s1, String s2)

Comparison method that will consider null Strings to be equivalent to empty Strings for comparison purposes; and compare equality with that caveat.

protected void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public abstract void
writeAsEncodedUnicode(Writer
The writer that will output the data
w
)

Redeclares javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
public abstract void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

mLocationback to summary
protected final Location mLocation

Deprecated

Call getLocation() instead.

Location where token started; exact definition may depends on event type.

TODO: remove direct dependencies to this by sub-classes; rename

Annotations
@Deprecated

Constructor Detail

BaseEventImplback to summary
protected BaseEventImpl(Location loc)

Method Detail

addHashback to summary
protected static int addHash(Iterator<?> it, int baseHash)
asCharactersback to summary
public Characters asCharacters()

Implements javax.xml.stream.events.XMLEvent.asCharacters.

Doc from javax.xml.stream.events.XMLEvent.asCharacters.

Returns this event as Characters, may result in a class cast exception if this event is not Characters.

Returns:Characters

a Characters event

Annotations
@Override
asEndElementback to summary
public EndElement asEndElement()

Implements javax.xml.stream.events.XMLEvent.asEndElement.

Doc from javax.xml.stream.events.XMLEvent.asEndElement.

Returns this event as an end element event, may result in a class cast exception if this event is not a end element.

Returns:EndElement

a EndElement event

Annotations
@Override
asStartElementback to summary
public StartElement asStartElement()

Implements javax.xml.stream.events.XMLEvent.asStartElement.

Doc from javax.xml.stream.events.XMLEvent.asStartElement.

Returns this event as a start element event, may result in a class cast exception if this event is not a start element.

Returns:StartElement

a StartElement event

Annotations
@Override
equalsback to summary
public abstract boolean equals(Object o)

Overrides java.lang.Object.equals.

Declared abstract to force redefinition by sub-classes

Parameters
o:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getEventTypeback to summary
public abstract int getEventType()

Redeclares javax.xml.stream.events.XMLEvent.getEventType.

Doc from javax.xml.stream.events.XMLEvent.getEventType.

Returns an integer code for this event.

Returns:int

the event type

Annotations
@Override
getLocationback to summary
public Location getLocation()

Implements javax.xml.stream.events.XMLEvent.getLocation.

Doc from javax.xml.stream.events.XMLEvent.getLocation.

Return the location of this event. The Location returned from this method is non-volatile and will retain its information.

Returns:Location

the location of the event

Annotations
@Override
getSchemaTypeback to summary
public QName getSchemaType()

Implements javax.xml.stream.events.XMLEvent.getSchemaType.

Doc from javax.xml.stream.events.XMLEvent.getSchemaType.

This method is provided for implementations to provide optional type information about the associated event. It is optional and will return null if no information is available.

Returns:QName

the type of the event, null if not available

Annotations
@Override
hashCodeback to summary
public abstract int hashCode()

Overrides java.lang.Object.hashCode.

Declared abstract to force redefinition by sub-classes

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
isAttributeback to summary
public boolean isAttribute()

Implements javax.xml.stream.events.XMLEvent.isAttribute.

Doc from javax.xml.stream.events.XMLEvent.isAttribute.

A utility function to check if this event is an Attribute.

Returns:boolean

true if the event is Attribute, false otherwise

Annotations
@Override
isCharactersback to summary
public boolean isCharacters()

Implements javax.xml.stream.events.XMLEvent.isCharacters.

Doc from javax.xml.stream.events.XMLEvent.isCharacters.

A utility function to check if this event is Characters.

Returns:boolean

true if the event is Characters, false otherwise

Annotations
@Override
isEndDocumentback to summary
public boolean isEndDocument()

Implements javax.xml.stream.events.XMLEvent.isEndDocument.

Doc from javax.xml.stream.events.XMLEvent.isEndDocument.

A utility function to check if this event is an EndDocument.

Returns:boolean

true if the event is EndDocument, false otherwise

Annotations
@Override
isEndElementback to summary
public boolean isEndElement()

Implements javax.xml.stream.events.XMLEvent.isEndElement.

Doc from javax.xml.stream.events.XMLEvent.isEndElement.

A utility function to check if this event is a EndElement.

Returns:boolean

true if the event is EndElement, false otherwise

Annotations
@Override
isEntityReferenceback to summary
public boolean isEntityReference()

Implements javax.xml.stream.events.XMLEvent.isEntityReference.

Doc from javax.xml.stream.events.XMLEvent.isEntityReference.

A utility function to check if this event is an EntityReference.

Returns:boolean

true if the event is EntityReference, false otherwise

Annotations
@Override
isNamespaceback to summary
public boolean isNamespace()

Implements javax.xml.stream.events.XMLEvent.isNamespace.

Doc from javax.xml.stream.events.XMLEvent.isNamespace.

A utility function to check if this event is a Namespace.

Returns:boolean

true if the event is Namespace, false otherwise

Annotations
@Override
isProcessingInstructionback to summary
public boolean isProcessingInstruction()

Implements javax.xml.stream.events.XMLEvent.isProcessingInstruction.

Doc from javax.xml.stream.events.XMLEvent.isProcessingInstruction.

A utility function to check if this event is a ProcessingInstruction.

Returns:boolean

true if the event is ProcessingInstruction, false otherwise

Annotations
@Override
isStartDocumentback to summary
public boolean isStartDocument()

Implements javax.xml.stream.events.XMLEvent.isStartDocument.

Doc from javax.xml.stream.events.XMLEvent.isStartDocument.

A utility function to check if this event is a StartDocument.

Returns:boolean

true if the event is StartDocument, false otherwise

Annotations
@Override
isStartElementback to summary
public boolean isStartElement()

Implements javax.xml.stream.events.XMLEvent.isStartElement.

Doc from javax.xml.stream.events.XMLEvent.isStartElement.

A utility function to check if this event is a StartElement.

Returns:boolean

true if the event is StartElement, false otherwise

Annotations
@Override
iteratedEqualsback to summary
protected static boolean iteratedEquals(Iterator<?> it1, Iterator<?> it2)
stringsWithNullsEqualback to summary
protected static boolean stringsWithNullsEqual(String s1, String s2)

Comparison method that will consider null Strings to be equivalent to empty Strings for comparison purposes; and compare equality with that caveat.

throwFromIOEback to summary
protected void throwFromIOE(IOException ioe) throws XMLStreamException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeAsEncodedUnicodeback to summary
public abstract void writeAsEncodedUnicode(Writer w) throws XMLStreamException

Redeclares javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

Doc from javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters. No indentation or whitespace should be outputted. Any user defined event type SHALL have this method called when being written to on an output stream. Built in Event types MUST implement this method, but implementations MAY choose not call these methods for optimizations reasons when writing out built in Events to an output stream. The output generated MUST be equivalent in terms of the infoset expressed.

Parameters
w:Writer

The writer that will output the data

Annotations
@Override
Exceptions
XMLStreamException:
if there is a fatal error writing the event
writeUsingback to summary
public abstract void writeUsing(XMLStreamWriter2 w) throws XMLStreamException

Redeclares org.codehaus.stax2.evt.XMLEvent2.writeUsing.

Annotations
@Override