keith-turner commented on code in PR #83: URL: https://github.com/apache/accumulo-access/pull/83#discussion_r1939923839
########## src/main/java/org/apache/accumulo/access/ParsedAccessExpression.java: ########## @@ -0,0 +1,73 @@ +/* + * 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 + * + * https://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.accumulo.access; + +import java.util.List; + +/** + * Instances of this class are immutable and wrap a verified access expression and a parse tree for + * the access expression. To create an instance of this class call + * {@link AccessExpression#parse(String)}. The Accumulo Access project has examples that show how to + * use the parse tree. + * + * @since 1.0.0 + */ +public abstract class ParsedAccessExpression extends AccessExpression { + + /* + * This is package private so that it can not be extended by classes outside of this package and + * create a mutable implementation. In this package all implementations that extends are + * immutable. + */ + ParsedAccessExpression() {} + + /** + * @since 1.0.0 + */ + public enum ExpressionType { + /** + * Indicates an access expression uses and operators at the top level. + */ + AND, + /** + * Indicates an access expression uses or operators at the top level. + */ + OR, + /** + * Indicates an access expression is a single authorization. For this type + * {@link #getExpression()} will return the authorization in quoted and escaped form. Depending + * on the use case {@link #unquote(String)} may need to be called. + */ + AUTHORIZATION, + /** + * Indicates this is the empty access expression. + */ + EMPTY + } + + public abstract ExpressionType getType(); + + /** + * When {@link #getType()} returns OR or AND, then this method will return the sub expressions. + * When {@link #getType()} method returns AUTHORIZATION or EMPTY this method will return an empty + * list. Review Comment: Added javadoc 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]
