Package org.keycloak.saml.common.parsers
Class AbstractStaxParser<T,E>
- java.lang.Object
- 
- org.keycloak.saml.common.parsers.AbstractStaxParser<T,E>
 
- 
- Type Parameters:
- T- Java class that will be result of parsing this element
- E- Type containing all tokens that can be found in subelements of the element parsed by this parser, usually an enum
 - All Implemented Interfaces:
- StaxParser
 - Direct Known Subclasses:
- AbstractStaxSamlAssertionParser,- AbstractStaxSamlMetadataParser,- AbstractStaxSamlProtocolParser,- AbstractStaxXmlDSigParser,- AnyDomParser
 
 public abstract class AbstractStaxParser<T,E> extends Object implements StaxParser Simple support for STaX type of parsing. Parses single element and allows processing its direct children.- Author:
- hmlnarik
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected QNameexpectedStartElementprotected static PicketLinkLoggerLOGGER
 - 
Constructor SummaryConstructors Constructor Description AbstractStaxParser(QName expectedStartElement, E unknownElement)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract EgetElementFromName(QName name)protected abstract TinstantiateElement(XMLEventReader xmlEventReader, StartElement element)Instantiates the target Java class representing the current element.
 Precondition: Current event is theStartElement
 Postcondition: Current event is theStartElementor theEndElementcorresponding to theStartElementprotected booleanisUnknownElement(E token)Tparse(XMLEventReader xmlEventReader)Parse the event streamprotected abstract voidprocessSubElement(XMLEventReader xmlEventReader, T target, E element, StartElement elementDetail)Processes the subelement of the element processed ininstantiateElement(javax.xml.stream.XMLEventReader, javax.xml.stream.events.StartElement)method.
 Precondition: Current event: Last before theStartElementcorresponding to the processed subelement, i.e.protected voidvalidateStartElement(StartElement startElement)Validates that the given startElement has the expected properties (namelyQNamematches the expected one).
 
- 
- 
- 
Field Detail- 
LOGGERprotected static final PicketLinkLogger LOGGER 
 - 
expectedStartElementprotected final QName expectedStartElement 
 
- 
 - 
Method Detail- 
parsepublic T parse(XMLEventReader xmlEventReader) throws ParsingException Description copied from interface:StaxParserParse the event stream- Specified by:
- parsein interface- StaxParser
- Returns:
- Throws:
- ParsingException
 
 - 
validateStartElementprotected void validateStartElement(StartElement startElement) Validates that the given startElement has the expected properties (namelyQNamematches the expected one).- Parameters:
- startElement-
 
 - 
isUnknownElementprotected boolean isUnknownElement(E token) 
 - 
instantiateElementprotected abstract T instantiateElement(XMLEventReader xmlEventReader, StartElement element) throws ParsingException Instantiates the target Java class representing the current element.
 Precondition: Current event is theStartElement
 Postcondition: Current event is theStartElementor theEndElementcorresponding to theStartElement- Parameters:
- xmlEventReader-
- element- The XML event that was just read from the- xmlEventReader
- Returns:
- Throws:
- ParsingException
 
 - 
processSubElementprotected abstract void processSubElement(XMLEventReader xmlEventReader, T target, E element, StartElement elementDetail) throws ParsingException Processes the subelement of the element processed ininstantiateElement(javax.xml.stream.XMLEventReader, javax.xml.stream.events.StartElement)method.
 Precondition: Current event: Last before theStartElementcorresponding to the processed subelement, i.e. event obtained byIterator.next()is theStartElementof the subelement being processed
 Postcondition: Event obtained byIterator.next()is either the sameStartElement(i.e. no change in position which causes this subelement to be skipped), the correspondingEndElement, or the event after the correspondingEndElement.Note that in case of recursive nesting the same element, the corresponding end element MUST be consumed in this method. - Parameters:
- xmlEventReader-
- target- Target object (the one created by the- instantiateElement(javax.xml.stream.XMLEventReader, javax.xml.stream.events.StartElement)method.
- element- The constant corresponding to the current start element.
- elementDetail- The XML event that was just read from the- xmlEventReader
- Throws:
- ParsingException
 
 
- 
 
-