Interface Bounds



  • public interface Bounds
    Base bounds interface from which all other bounds extend.
    • 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.
        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 support only one (or very few) required class and 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.