Class PageableFieldValidator


  • public final class PageableFieldValidator
    extends java.lang.Object
    Finds out if an entity field is pageable and validates paging parameters.
    Author:
    Dmitry Kornilov
    • Constructor Summary

      Constructors 
      Constructor Description
      PageableFieldValidator​(java.lang.Class entityClass, java.lang.String fieldName, javax.ws.rs.core.UriInfo uri)
      Creates the validator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLimit()
      Returns a value of Limit paging parameter.
      int getOffset()
      Returns a value of Offset paging parameter.
      boolean isFeatureApplicable()
      Checks if request is valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageableFieldValidator

        public PageableFieldValidator​(java.lang.Class entityClass,
                                      java.lang.String fieldName,
                                      javax.ws.rs.core.UriInfo uri)
        Creates the validator.
        Parameters:
        entityClass - entity class containing a field to validate.
        fieldName - field name to validate.
        uri - request URI.
    • Method Detail

      • isFeatureApplicable

        public boolean isFeatureApplicable()
                                    throws JPARSException
        Checks if request is valid.
        Returns:
        true if request is valid and supports pagination, false if request is valid but doesn't support pagination.
        Throws:
        JPARSException - in case of any validation errors.
      • getOffset

        public int getOffset()
        Returns a value of Offset paging parameter. The value is available only after calling checkParameters method.
        Returns:
        the Offset value.
      • getLimit

        public int getLimit()
        Returns a value of Limit paging parameter. The value is available only after calling checkParameters method.
        Returns:
        the Limit value.