Class PatternAndBuildBasedModelProvider
java.lang.Object
ch.tocco.nice2.model.base.impl.base.PatternAndBuildBasedModelProvider
- All Implemented Interfaces:
NiceModelProvider
- Direct Known Subclasses:
ModuleResourcesModelProvider
This ModelProvider has two behaviors:
First: Based on the pattern given from the
For example a pattern could be: basePath="model/entities" and the pattern="*mode.xml". So with this path and pattern, the
Second: Based on the type of
Usage:
You contribute all configurations-reader to this instance. The contribution defines in which path and based on what pattern the configuration is then passed to those readers.
First: Based on the pattern given from the
SourceContribution.getPattern()
and the given
SourceContribution.getBasePath()
it will decide if this resource needs to be parsed.For example a pattern could be: basePath="model/entities" and the pattern="*mode.xml". So with this path and pattern, the
PatternAndBuildBasedModelProvider
will only pass the config-file to the NiceModelBuilder
when it matches this pattern and path.
Second: Based on the type of
SourceContribution.getBuilder()
it will send the content to that builder.
So its intended that all kinds of NiceModelBuilder
are passed to this implementation. Like a
FormModelBuilder and a EntityModelBuilder. But those Builders acutally build completly diffrent models. So the
the PatternAndBuildBasedModelProvider
decided based on the model-type, if the propriate reader is found or not.
Usage:
You contribute all configurations-reader to this instance. The contribution defines in which path and based on what pattern the configuration is then passed to those readers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.Logger
protected List
<SourceContribution> Fields inherited from interface ch.tocco.nice2.model.base.spi.base.NiceModelProvider
MODULE_RESOURCES_ORDER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
readModels
(ModelResource dir, SourceContribution src, Object receiver) Recursive reading of all resources of the directory.void
setSources
(List<SourceContribution> sources) 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.NiceModelProvider
readModels
-
Field Details
-
log
protected final org.slf4j.Logger log -
sources
-
-
Constructor Details
-
PatternAndBuildBasedModelProvider
public PatternAndBuildBasedModelProvider(org.slf4j.Logger log)
-
-
Method Details
-
setSources
-
readModels
Recursive reading of all resources of the directory.
-