public class DocCollectorImpl extends java.lang.Object implements DocCollector
DocCollector
,.Modifier and Type | Field and Description |
---|---|
private DocgenConfig |
_docgenCfg |
private boolean |
_fromUml |
private static org.apache.log4j.Logger |
_logger |
private ModelFinder |
_modelFinder |
private java.util.Map<java.lang.String,PackageDoc> |
_modelPackageDocs
Model package docs are indexed, the individual package docs contain their children
recursively; we use this map for logging only.
|
private java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,java.util.List<PackageDoc>>>> |
_nonSkippedNsPackageDocs
"Categorised" docs for all retained packages.
|
private java.util.Map<java.lang.String,java.util.List<PackageDoc>> |
_nonSkippedPackageDocs
"Flattenned" docs for all retained packages.
|
private java.util.List<java.lang.String> |
_skippedInfPackageQNames |
Modifier | Constructor and Description |
---|---|
|
DocCollectorImpl(Config cfg,
ModelFinder modelFinder)
Constructs the instance to manually (through API) add documentation for package and other UML
objects.
|
private |
DocCollectorImpl(Config cfg,
ModelFinder modelFinder,
boolean fromUml) |
|
DocCollectorImpl(UmlModel model)
Constructs the collector from the UML model.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
_getSkippedInfPackageQNames()
Returns qualified names of all the skipped packages.
|
boolean |
addSkippedInformativePackage(java.lang.String qName)
Must be called by every newly created
PackageDoc that is to be skipped. |
void |
addToFlattened(PackageDoc packageDoc)
Must be called by every newly created
PackageDoc that need not be skipped. |
void |
addToScoped(PackageDoc packageDoc)
Must be called by every newly created
PackageDoc that need not be skipped, if
owner is in scope and it needs to be included in the name space: adds the
packageDoc under appropriate nature and name space, no-op otherwise. |
private java.util.Map<java.lang.String,PackageDoc> |
buildPackageDocs(DocgenConfig docgenCfg,
java.util.Collection<UmlPackage> modelPackages)
Builds recursively package docs for
modelPackages ; every instance will add
itself with addToFlattened(PackageDoc) method to flattened map, and with
addToScoped(PackageDoc) to scoped mapd of retained packages. |
void |
collect(UmlModel model)
Collects recursively documentation from UML model packages, their sub-packages, etc.
|
DocgenConfig |
getDocgenCfg()
Returns configuration according to which the documentation is collected for generation.
|
FixedFormDocumentation |
getFixedFormDocumentation()
Returns documentation per package, indexed by nature.
|
FreeFormDocumentation |
getFreeFormDocumentation()
Returns documentation per package, indexed by package name for easy reference; if there were
any two packages with the same name, retains only the first one collected.
|
(package private) ModelFinder |
getModelFinder() |
(package private) java.util.Map<java.lang.String,PackageDoc> |
getModelPackageDocs()
Returns package docs for all
UmlPackage.Kind.MODEL
packages from the UML model, indexed by the
UmlPackage.Kind.MODEL package name. |
(package private) java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,java.util.List<PackageDoc>>>> |
getNonSkippedNsPackageDocs() |
(package private) java.util.Map<java.lang.String,java.util.List<PackageDoc>> |
getNonSkippedPackageDocs() |
boolean |
isFromUml()
Returns whether this collector has been created from a UML model (as opposed to pure API
calls).
|
private java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,PackageDoc>>> |
removeNsDuplicates() |
private static java.util.Map<java.lang.String,PackageDoc> |
selectWithoutDuplicates(java.util.Map<java.lang.String,java.util.List<PackageDoc>> all)
This is one final result, where the
_nonSkippedPackageDocs is filtered by retaining
only one package doc per name. |
java.lang.String |
toString() |
private static final org.apache.log4j.Logger _logger
private final DocgenConfig _docgenCfg
private final ModelFinder _modelFinder
private final boolean _fromUml
private final java.util.Map<java.lang.String,PackageDoc> _modelPackageDocs
getNonSkippedPackageDocs()
.private final java.util.Map<java.lang.String,java.util.List<PackageDoc>> _nonSkippedPackageDocs
PackageDoc
on creation.private final java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,java.util.List<PackageDoc>>>> _nonSkippedNsPackageDocs
PackageDoc
on creation.private final java.util.List<java.lang.String> _skippedInfPackageQNames
public DocCollectorImpl(UmlModel model)
collect(UmlModel)
to obtain the input for document generation.model
- public DocCollectorImpl(Config cfg, ModelFinder modelFinder)
cfg
- modelFinder
- private DocCollectorImpl(Config cfg, ModelFinder modelFinder, boolean fromUml)
java.util.Map<java.lang.String,java.util.List<PackageDoc>> getNonSkippedPackageDocs()
java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,java.util.List<PackageDoc>>>> getNonSkippedNsPackageDocs()
ModelFinder getModelFinder()
java.util.Map<java.lang.String,PackageDoc> getModelPackageDocs()
UmlPackage.Kind.MODEL
packages from the UML model, indexed by the
UmlPackage.Kind.MODEL
package name. Each package doc
contains all the non-skipped child element docs, recursively. The flattened map of all
retained package docs, including packages with the same name, can be obtained with
getNonSkippedPackageDocs()
, and the flattened map without duplicates with
selectWithoutDuplicates(Map)
.
Implementation note: This map is not of much value for document generation, it is used only for logging.
public void collect(UmlModel model)
DocCollector
collect
in interface DocCollector
model
- UML model.public FreeFormDocumentation getFreeFormDocumentation()
DocCollector
getFreeFormDocumentation
in interface DocCollector
public FixedFormDocumentation getFixedFormDocumentation()
DocCollector
getFixedFormDocumentation
in interface DocCollector
private java.util.Map<Nature,java.util.Map<NamespaceInfo,java.util.Map<java.lang.String,PackageDoc>>> removeNsDuplicates()
private java.util.Map<java.lang.String,PackageDoc> buildPackageDocs(DocgenConfig docgenCfg, java.util.Collection<UmlPackage> modelPackages)
modelPackages
; every instance will add
itself with addToFlattened(PackageDoc)
method to flattened map, and with
addToScoped(PackageDoc)
to scoped mapd of retained packages.public void addToFlattened(PackageDoc packageDoc)
DocCollector
PackageDoc
that need not be skipped.addToFlattened
in interface DocCollector
packageDoc
- package documentation to retain.public void addToScoped(PackageDoc packageDoc)
DocCollector
PackageDoc
that need not be skipped, if
owner
is in scope and it needs to be included in the name space: adds the
packageDoc
under appropriate nature and name space, no-op otherwise.addToScoped
in interface DocCollector
public boolean addSkippedInformativePackage(java.lang.String qName)
DocCollector
PackageDoc
that is to be skipped. Returns
whether qName
has been added to the collection of skipped informative package
names. Because it is intended to be used for logging only, we don't need objects (strings are
enough).addSkippedInformativePackage
in interface DocCollector
qName
- qualified name of the package.private static java.util.Map<java.lang.String,PackageDoc> selectWithoutDuplicates(java.util.Map<java.lang.String,java.util.List<PackageDoc>> all)
_nonSkippedPackageDocs
is filtered by retaining
only one package doc per name.public DocgenConfig getDocgenCfg()
DocCollector
getDocgenCfg
in interface DocCollector
public java.util.List<java.lang.String> _getSkippedInfPackageQNames()
DocCollector
_getSkippedInfPackageQNames
in interface DocCollector
public boolean isFromUml()
DocCollector
isFromUml
in interface DocCollector
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2009-2015 Tatjana (Tanja) Kostic