Interface Bounds


  • public interface Bounds
    Base bounds interface from which all other bounds extend.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <D,​C extends Content<D>>
      Optional<D>
      getData​(C content)
      Get the subset of data which is covered by these bounds, returning the data in the native format of the Content.
      <D,​C extends Content<D>,​R>
      Optional<R>
      getData​(C content, Class<R> requiredClass)
      Get the subset of data which is covered by these bounds.
      <D,​C extends Content<D>>
      boolean
      isValid​(C content)
      Are these bounds valid for the provided content?
    • Method Detail

      • getData

        default <D,​C extends Content<D>> Optional<D> getData​(C content)
        Get the subset of data which is covered by these bounds, returning the data in the native format of the Content.
        Type Parameters:
        C - content class
        D - data class
        Parameters:
        content - the content the bounds should be applied to
        Returns:
        optional empty if there is nothing covered.
      • getData

        <D,​C extends Content<D>,​R> Optional<R> getData​(C content,
                                                                   Class<R> requiredClass)
        Get the subset of data which is covered by these bounds.

        Most bounds will likely processor only one (or very few) required class and data class.

        Type Parameters:
        C - content class
        D - data class
        R - required data class
        Parameters:
        content - the content the bounds should be applied to
        requiredClass - the type of data required
        Returns:
        optional empty if there is nothing covered, or if the combinations are not supported.
      • isValid

        <D,​C extends Content<D>> boolean isValid​(C content)
        Are these bounds valid for the provided content?

        This means that for example the type of bounds are applicable for the data (ie bounds designed for text are not applicable to image data) and that specifically this bounds is within the content. (ie in the of text the bounds don't lie outside the range of the text).

        Note that returning true here does not imply that getData will not be empty. The bounds may apply to the content but they may still cover no data.

        Type Parameters:
        C - content class
        D - data class
        Parameters:
        content - the content to check
        Returns:
        true is this bounds can be used with this content