eric-maynard commented on code in PR #1528:
URL: https://github.com/apache/polaris/pull/1528#discussion_r2078533533


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/pagination/ReadEverythingPageToken.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.persistence.pagination;
+
+import java.util.List;
+
+/**
+ * A {@link PageToken} implementation for readers who want to read everything. 
The behavior when
+ * using this token should be the same as when reading without a token.
+ */
+public class ReadEverythingPageToken extends PageToken {
+
+  private ReadEverythingPageToken() {
+    this.pageSize = Integer.MAX_VALUE;
+    validate();
+  }
+
+  /** Get a {@link ReadEverythingPageToken} */
+  public static ReadEverythingPageToken get() {
+    return new ReadEverythingPageToken();
+  }
+
+  public static PageTokenBuilder<ReadEverythingPageToken> builder() {
+    return new ReadEverythingPageTokenBuilder();
+  }
+
+  @Override
+  protected PageTokenBuilder<?> getBuilder() {
+    return builder();
+  }
+
+  /** A {@link PageTokenBuilder} implementation for {@link 
ReadEverythingPageToken} */
+  public static class ReadEverythingPageTokenBuilder
+      extends PageTokenBuilder<ReadEverythingPageToken> {
+
+    private ReadEverythingPageTokenBuilder() {}
+
+    @Override
+    public String tokenPrefix() {
+      return "polaris-read-everything";
+    }
+
+    @Override
+    public int expectedComponents() {
+      return 0;
+    }
+
+    @Override
+    protected ReadEverythingPageToken fromStringComponents(List<String> 
components) {
+      return ReadEverythingPageToken.get();

Review Comment:
   I see... I still think placing the logic (e.g. parsing the string 
representation) inside the PageToken implementation is nice encapsulation.
   
   This specific comment is correct in that `fromStringComponents` in 
`ReadEverythingPageToken` looks a little funny, but if you look in 
`PageToken.fromString`, you'll see that we aren't just throwing out the 
components; we first check the length.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to