Class AbstractXMLUnmarshallerModelBuilder
java.lang.Object
ch.tocco.nice2.model.base.spi.base.AbstractXMLUnmarshallerModelBuilder
- All Implemented Interfaces:
NiceModelBuilder
- Direct Known Subclasses:
AbstractXmlMenuBuilder
,FormBuilder
,RemoveFormBuilder
,XMLFormBuilder
,XMLFormRemove
,XMLNiceEntityBuilder
,XMLRelationBuilder
,XMLRelationOverrideBuilder
,XMLRemove
,XMLTemplateBuilder
public abstract class AbstractXMLUnmarshallerModelBuilder
extends Object
implements NiceModelBuilder
An abstract model builder, which already sets up the history-writer, log etc.
Usage:
- Create subclass. Garanties that all arguments on the constructor aren't null.
- Create an instance (
buildHandlerInstance(Object)
) of an annotated class which can be interpreted by theUnmarshaller
- Provide the name of the first xml-tag in
getFirstTag()
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DisplayValueFactory
protected final SAXParserFactory
protected final org.slf4j.Logger
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractXMLUnmarshallerModelBuilder
(org.slf4j.Logger log, DisplayValueFactory displayValueFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterParse
(URI location) Will be called after the parsing endedprotected boolean
beforeParse
(URI location) Will be called before the parsing begins.protected abstract Object
buildHandlerInstance
(Object receiver) Return a new instance of a class, which can handle the event of the xml-unmarshallerfinal void
buildModel
(InputStream source, URI location, Object receiver) protected abstract String
Return the name of the first xml-tagprotected boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.model.base.spi.base.NiceModelBuilder
getType
-
Field Details
-
log
protected final org.slf4j.Logger log -
factory
-
displayValueFactory
-
-
Constructor Details
-
AbstractXMLUnmarshallerModelBuilder
protected AbstractXMLUnmarshallerModelBuilder(org.slf4j.Logger log, DisplayValueFactory displayValueFactory)
-
-
Method Details
-
buildHandlerInstance
Return a new instance of a class, which can handle the event of the xml-unmarshaller State: It's guaranteed that all protected methods are set and valid- Parameters:
receiver
- the receiver.- Returns:
- the instance, non-null.
-
getFirstTag
Return the name of the first xml-tag- Returns:
- non-null
-
buildModel
public final void buildModel(InputStream source, URI location, Object receiver) throws ModelBuildException - Specified by:
buildModel
in interfaceNiceModelBuilder
- Parameters:
source
- the source-stream. The stream gets closed by the caller.location
- the location as URIreceiver
- the receiver- Throws:
ModelBuildException
- if something went wrong
-
beforeParse
Will be called before the parsing begins.- Parameters:
location
- the current location or null- Returns:
- veto. if true the current location will not be parsed
-
afterParse
Will be called after the parsing ended- Parameters:
location
- the current location or null
-
shouldIgnoreUnhandledAttributes
protected boolean shouldIgnoreUnhandledAttributes()
-