Package org.apache.maven.model.building
Class DefaultModelProblemCollector
- java.lang.Object
-
- org.apache.maven.model.building.DefaultModelProblemCollector
-
- All Implemented Interfaces:
ModelProblemCollector
,ModelProblemCollectorExt
class DefaultModelProblemCollector extends java.lang.Object implements ModelProblemCollectorExt
Collects problems that are encountered during model building. The primary purpose of this component is to account for the fact that the problem reporter has/should not have information about the calling context and hence cannot provide an expressive source hint for the model problem. Instead, the source hint is configured by the model builder before it delegates to other components that potentially encounter problems. Then, the problem reporter can focus on providing a simple error message, leaving the donkey work of creating a nice model problem to this component.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ModelProblem>
problems
private ModelBuildingResult
result
private Model
rootModel
private java.util.Set<ModelProblem.Severity>
severities
private java.lang.String
source
private Model
sourceModel
-
Constructor Summary
Constructors Constructor Description DefaultModelProblemCollector(ModelBuildingResult result)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ModelProblem problem)
void
add(ModelProblemCollectorRequest req)
Adds the specified problem.void
addAll(java.util.List<ModelProblem> problems)
private java.lang.String
getModelId()
java.util.List<ModelProblem>
getProblems()
The collected problems.Model
getRootModel()
java.lang.String
getRootModelId()
private java.lang.String
getSource()
boolean
hasErrors()
boolean
hasFatalErrors()
ModelBuildingException
newModelBuildingException()
void
setRootModel(Model rootModel)
void
setSource(java.lang.String source)
void
setSource(Model source)
-
-
-
Field Detail
-
result
private final ModelBuildingResult result
-
problems
private java.util.List<ModelProblem> problems
-
source
private java.lang.String source
-
sourceModel
private Model sourceModel
-
rootModel
private Model rootModel
-
severities
private java.util.Set<ModelProblem.Severity> severities
-
-
Constructor Detail
-
DefaultModelProblemCollector
DefaultModelProblemCollector(ModelBuildingResult result)
-
-
Method Detail
-
hasFatalErrors
public boolean hasFatalErrors()
-
hasErrors
public boolean hasErrors()
-
getProblems
public java.util.List<ModelProblem> getProblems()
Description copied from interface:ModelProblemCollectorExt
The collected problems.- Specified by:
getProblems
in interfaceModelProblemCollectorExt
- Returns:
- a list of model problems encountered, never
null
-
setSource
public void setSource(java.lang.String source)
-
setSource
public void setSource(Model source)
-
getSource
private java.lang.String getSource()
-
getModelId
private java.lang.String getModelId()
-
setRootModel
public void setRootModel(Model rootModel)
-
getRootModel
public Model getRootModel()
-
getRootModelId
public java.lang.String getRootModelId()
-
add
public void add(ModelProblem problem)
-
addAll
public void addAll(java.util.List<ModelProblem> problems)
-
add
public void add(ModelProblemCollectorRequest req)
Description copied from interface:ModelProblemCollector
Adds the specified problem.- Specified by:
add
in interfaceModelProblemCollector
- Parameters:
req
- must not be null
-
newModelBuildingException
public ModelBuildingException newModelBuildingException()
-
-