src/main/java/de/digitalcollections/iiif/model/search/SearchResult.java
@Override
  public SearchResult addWithin(Resource first, Resource... rest) throws IllegalArgumentException {
    if (!(first instanceof SearchLayer) || Arrays.stream(rest).anyMatch(r -> !(r instanceof SearchLayer))) {
      throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
    }
    super.addWithin(first, rest);
    return this;
  }
@Override
  public SearchResult addWithin(Resource first, Resource... rest) throws IllegalArgumentException {
    if (!(first instanceof SearchLayer) || Arrays.stream(rest).anyMatch(r -> !(r instanceof SearchLayer))) {
      throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
    }
    super.addWithin(first, rest);
    return this;
  }
@ Override public SearchResult addWithin ( Resource first , Resource ... rest ) throws IllegalArgumentException { if ( ! ( first instanceof SearchLayer ) || Arrays . stream ( rest ) . anyMatch ( r -> ! ( r instanceof SearchLayer ) ) ) { throw new IllegalArgumentException ( "SearchResult can only be within a SearchLayer." ) ; } super . addWithin ( first , rest ) ; return this ; }
Add a new containing resource. Must be an instance of {@link SearchLayer}

@throws IllegalArgumentException if the resource is not a {@link SearchLayer}
Add a new containing resource . Must be an instance of { @link SearchLayer }