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 * http://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 /** 25 * Root expression node interface which all expression nodes in the filter 26 * expression tree implement. 27 * 28 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 29 */ 30 public interface ExprNode extends Cloneable 31 { 32 /** 33 * Gets an annotation on the tree by key. 34 * 35 * @param key the annotation key. 36 * @return the annotation value. 37 */ 38 Object get( Object key ); 39 40 41 /** 42 * Sets a annotation key to a value. 43 * 44 * @param key the annotation key. 45 * @param value the annotation value. 46 */ 47 void set( String key, Object value ); 48 49 50 /** 51 * Tests to see if this node is a leaf or branch node. 52 * 53 * @return true if the node is a leaf,false otherwise 54 */ 55 boolean isLeaf(); 56 57 58 /** 59 * Tells if this Node is Schema aware. 60 * 61 * @return true if the Node is SchemaAware 62 */ 63 boolean isSchemaAware(); 64 65 66 /** 67 * Gets the assertion type of this node. Make it possible to use switch 68 * statements on the node type. 69 * 70 * @return the assertion type 71 */ 72 AssertionType getAssertionType(); 73 74 75 /** 76 * Recursively appends the refinement string representation of this node and its 77 * descendants in prefix notation to a buffer. 78 * 79 * @param buf the buffer to append to. 80 * @return The buffer in which the refinement has been appended 81 * @throws UnsupportedOperationException if this node isn't a part of a refinement. 82 */ 83 StringBuilder printRefinementToBuffer( StringBuilder buf ); 84 85 86 /** 87 * Element/node accept method for visitor pattern. 88 * 89 * @param visitor the filter expression tree structure visitor 90 * @return the modified element 91 */ 92 Object accept( FilterVisitor visitor ); 93 94 95 /** 96 * Clone this expression node. 97 * 98 * @return the cloned expression node 99 */ 100 ExprNode clone(); 101 }