keith-turner commented on code in PR #31:
URL: https://github.com/apache/accumulo-access/pull/31#discussion_r1465438092
##########
src/main/java/org/apache/accumulo/access/AccessExpression.java:
##########
@@ -59,47 +74,103 @@ public interface AccessExpression {
String getExpression();
/**
- * Deduplicate, sort, and flatten expressions.
- *
+ * @return the unique set of authorizations that occur in the expression.
For example, for the
+ * expression {@code (A&B)|(A&C)|(A&D)}, this method would return
{@code [A,B,C,D]}.
+ */
+ Authorizations getAuthorizations();
+
+ /**
+ * This is equivalent to calling {@code AccessExpression.of(expression,
false);}
+ */
+ static AccessExpression of(String expression) throws
IllegalAccessExpressionException {
+ return new AccessExpressionImpl(expression, false);
+ }
+
+ /**
* <p>
- * As an example of flattening, the expression {@code A&(B&C)} can be
flattened to {@code A&B&C}.
+ * Validates an access expression and creates an immutable AccessExpression
object.
*
* <p>
- * As an example of sorting, the expression {@code (Z&Y)|(C&B)} can be
sorted to
- * {@code (B&C)|(Y&Z)}
+ * When the {@code normalize} parameter is true, then will deduplicate,
sort, flatten, and remove
+ * unneeded parens in the expressions. Normalization is done in addition to
validation. The
+ * following list gives examples of what each normalization step does.
*
- * <p>
- * As an example of deduplication, the expression {@code X&Y&X} is
equivalent to {@code X&Y}
+ * <ul>
+ * <li>As an example of flattening, the expression {@code A&(B&C)} can be
flattened to
+ * {@code A&B&C}.</li>
+ * <li>As an example of sorting, the expression {@code (Z&Y)|(C&B)} can be
sorted to
+ * {@code (B&C)|(Y&Z)}</li>
+ * <li>As an example of deduplication, the expression {@code X&Y&X} is
equivalent to
+ * {@code X&Y}</li>
+ * <li>As an example of unneed parens, the expression {@code "ABC"&"XYZ"} is
equivalent to
Review Comment:
Unneeded quotes and parens will be removed, I'll update the docs for that.
--
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]