1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * https://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 21 package org.apache.directory.api.ldap.model.filter; 22 23 /** 24 * Root expression node interface which all expression nodes in the filter 25 * expression tree implement. 26 * 27 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 28 */ 29 public interface ExprNode extends Cloneable 30 { 31 /** 32 * Gets an annotation on the tree by key. 33 * 34 * @param key the annotation key. 35 * @return the annotation value. 36 */ 37 Object get( Object key ); 38 39 40 /** 41 * Sets a annotation key to a value. 42 * 43 * @param key the annotation key. 44 * @param value the annotation value. 45 */ 46 void set( String key, Object value ); 47 48 49 /** 50 * Tests to see if this node is a leaf or branch node. 51 * 52 * @return true if the node is a leaf,false otherwise 53 */ 54 boolean isLeaf(); 55 56 57 /** 58 * Tells if this Node is Schema aware. 59 * 60 * @return true if the Node is SchemaAware 61 */ 62 boolean isSchemaAware(); 63 64 65 /** 66 * Gets the assertion type of this node. Make it possible to use switch 67 * statements on the node type. 68 * 69 * @return the assertion type 70 */ 71 AssertionType getAssertionType(); 72 73 74 /** 75 * Recursively appends the refinement string representation of this node and its 76 * descendants in prefix notation to a buffer. 77 * 78 * @param buf the buffer to append to. 79 * @return The buffer in which the refinement has been appended 80 * @throws UnsupportedOperationException if this node isn't a part of a refinement. 81 */ 82 StringBuilder printRefinementToBuffer( StringBuilder buf ); 83 84 85 /** 86 * Element/node accept method for visitor pattern. 87 * 88 * @param visitor the filter expression tree structure visitor 89 * @return the modified element 90 */ 91 Object accept( FilterVisitor visitor ); 92 93 94 /** 95 * Clone this expression node. 96 * 97 * @return the cloned expression node 98 */ 99 ExprNode clone(); 100 }