dlmarion commented on code in PR #31:
URL: https://github.com/apache/accumulo-access/pull/31#discussion_r1461900901
##########
src/main/java/org/apache/accumulo/access/AccessExpression.java:
##########
@@ -34,70 +30,62 @@
* var auth3 = AccessExpression.quote("🦖");
* var visExp = AccessExpression
* .of("(" + auth1 + "&" + auth3 + ")|(" + auth1 + "&" + auth2 + "&" +
auth1 + ")");
- * System.out.println(visExp.getExpression());
- * System.out.println(visExp.normalize());
- * System.out.println(visExp.getAuthorizations());
+ * System.out.println(visExp);
+ * System.out.println(AccessExpression.getAuthorizations(visExp));
* }
* </pre>
*
* The above example will print the following.
*
* <pre>
* (CAT&"🦖")|(CAT&"🦕"&CAT)
- * ("🦕"&CAT)|("🦖"&CAT)
* [🦖, CAT, 🦕]
* </pre>
*
+ * The following code will throw an {@link IllegalAccessExpressionException}
because the expression
+ * is not valid.
+ *
+ * <pre>
+ * {@code
+ * AccessExpression.validate("A&B|C");
+ * }
+ * </pre>
+ *
+ *
* @see <a href="https://github.com/apache/accumulo-access">Accumulo Access
Documentation</a>
* @since 1.0.0
*/
public interface AccessExpression {
Review Comment:
I think this Object could use a Builder. The quote and normalize methods
return strings, so it's not readily apparent how to create the
AccessExpression. If you wanted to quote and normalize, would you need to
create multiple AccessExpression objects?
Also, since the quote method will only quote if quoting is necessary, should
we quote each term in the access expression if needed automatically?
If we keep the normalize method as an optional operation, then we could use
it in the following manner:
```
AccessExpression expr =
AccessExpression.builder().of("my&expression").normalize().build();
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]