org.glassfish.jersey.server.model
Class BasicValidator

java.lang.Object
  extended by org.glassfish.jersey.server.model.ResourceModelValidator
      extended by org.glassfish.jersey.server.model.BasicValidator
All Implemented Interfaces:
ResourceModelVisitor

public class BasicValidator
extends ResourceModelValidator

Performs a basic check on abstract resources.

Validity check populates a list of potential issues with the given resource. The issues are divided into two categories: fatal and non-fatal issues. The former type prevents the resource to be deployed and makes the whole web application deployment fail.

To check a single resource class, one could use one of the Resource builder(...) methods to get a resource model. ResourceModelValidator.validate(ResourceModelComponent) method then populates the issue list, which could be then obtained by the ResourceModelValidator.getIssueList(). Unless you explicitly clear the list, subsequent calls to the validate method will add new items to the list, so that you can build the issue list for more than one resource. To clear the list, you may want to call ResourceModelValidator.cleanIssueList() method.

Author:
Jakub Podlesak (jakub.podlesak at oracle.com), Marek Potociar (marek.potociar at oracle.com)

Field Summary
protected  Set<Class<?>> checkedClasses
          Classes that have been checked already.
 
Constructor Summary
BasicValidator()
          Construct a new basic validator with an empty issue list.
BasicValidator(List<ResourceModelIssue> issueList)
          Construct a new basic validator.
BasicValidator(List<ResourceModelIssue> issueList, MessageBodyWorkers workers)
          Construct a new basic validator.
 
Method Summary
static boolean isSingleton(Class<?> resourceClass)
          Check if the resource class is declared to be a singleton.
 void visitInvocable(Invocable invocable)
          Visit a single resource method invocable model.
 void visitMethodHandler(MethodHandler methodHandler)
          Visit a single resource method handler model.
 void visitResourceClass(Resource resource)
          Start visiting a single resource model.
 void visitResourceHandlerConstructor(HandlerConstructor constructor)
          Process a resource method handler constructor.
 void visitResourceMethod(ResourceMethod method)
          Visit a single resource method model.
 
Methods inherited from class org.glassfish.jersey.server.model.ResourceModelValidator
addFatalIssue, addMinorIssue, cleanIssueList, fatalIssuesFound, getIssueList, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checkedClasses

protected final Set<Class<?>> checkedClasses
Classes that have been checked already.

Constructor Detail

BasicValidator

public BasicValidator()
Construct a new basic validator with an empty issue list.


BasicValidator

public BasicValidator(List<ResourceModelIssue> issueList)
Construct a new basic validator.

Parameters:
issueList - validation issue list.

BasicValidator

public BasicValidator(List<ResourceModelIssue> issueList,
                      MessageBodyWorkers workers)
Construct a new basic validator.

Parameters:
issueList - validation issue list.
workers - message body workers for computing effective types.
Method Detail

visitResourceClass

public void visitResourceClass(Resource resource)
Description copied from interface: ResourceModelVisitor
Start visiting a single resource model.

Parameters:
resource - resource model.

visitResourceHandlerConstructor

public void visitResourceHandlerConstructor(HandlerConstructor constructor)
Description copied from interface: ResourceModelVisitor
Process a resource method handler constructor. Typically a constructor of a JAX-RS annotated resource class.

Parameters:
constructor - resource method handler constructor.

isSingleton

public static boolean isSingleton(Class<?> resourceClass)
Check if the resource class is declared to be a singleton.

Parameters:
resourceClass - resource class.
Returns:
true if the resource class is a singleton, false otherwise.

visitInvocable

public void visitInvocable(Invocable invocable)
Description copied from interface: ResourceModelVisitor
Visit a single resource method invocable model.

Parameters:
invocable - resource method invocable model.

visitMethodHandler

public void visitMethodHandler(MethodHandler methodHandler)
Description copied from interface: ResourceModelVisitor
Visit a single resource method handler model.

Parameters:
methodHandler - resource method handler model.

visitResourceMethod

public void visitResourceMethod(ResourceMethod method)
Description copied from interface: ResourceModelVisitor
Visit a single resource method model.

Parameters:
method - resource method model.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.