Class ComponentModelValidator
- java.lang.Object
-
- org.glassfish.jersey.server.model.ComponentModelValidator
-
public final class ComponentModelValidator extends java.lang.Object
A resource model validator that checks the given resource model. This base resource model validator class implements the visitor pattern to traverse through all theresource model components
to check validity of a resource model. This validator maintains a list of all theissues
found in the model. That way all the resource model components can be validated in a single call to thevalidate(...)
method and collect all the validation issues from the model. To check a single resource class, the theResource
builder(...)
can be used to create a resource model.validate(ResourceModelComponent)
method then populates the issue list, which could be then obtained by thegetIssueList()
. Unless the list is explicitly cleared, a subsequent calls to the validate method will add new items to the list, so that it can be used to build the issue list for more than one resource. To clear the list, thecleanIssueList()
method should be called.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ResourceModelIssue>
issueList
private java.util.List<ResourceModelVisitor>
validators
-
Constructor Summary
Constructors Constructor Description ComponentModelValidator(java.util.Collection<ValueParamProvider> valueParamProviders, MessageBodyWorkers msgBodyWorkers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanIssueList()
Removes all issues from the current issue list.boolean
fatalIssuesFound()
Convenience method to see if there were fatal issues found.java.util.List<ResourceModelIssue>
getIssueList()
Returns a list of issues found aftervalidate(org.glassfish.jersey.server.model.ResourceModelComponent)
method has been invoked.void
validate(ResourceModelComponent component)
The validate method validates a component and adds possible issues found to it's list.private void
validateWithErrors(ResourceModelComponent component)
-
-
-
Field Detail
-
issueList
private final java.util.List<ResourceModelIssue> issueList
-
validators
private final java.util.List<ResourceModelVisitor> validators
-
-
Constructor Detail
-
ComponentModelValidator
public ComponentModelValidator(java.util.Collection<ValueParamProvider> valueParamProviders, MessageBodyWorkers msgBodyWorkers)
-
-
Method Detail
-
getIssueList
public java.util.List<ResourceModelIssue> getIssueList()
Returns a list of issues found aftervalidate(org.glassfish.jersey.server.model.ResourceModelComponent)
method has been invoked.- Returns:
- a non-null list of issues.
-
fatalIssuesFound
public boolean fatalIssuesFound()
Convenience method to see if there were fatal issues found.- Returns:
true
if there are any fatal issues present in the current issue list.
-
cleanIssueList
public void cleanIssueList()
Removes all issues from the current issue list. The method could be used to re-use the sameComponentModelValidator
for another resource model.
-
validate
public void validate(ResourceModelComponent component)
The validate method validates a component and adds possible issues found to it's list. The list of issues could be then retrieved via getIssueList method.- Parameters:
component
- resource model component.
-
validateWithErrors
private void validateWithErrors(ResourceModelComponent component)
-
-