001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 021package org.apache.directory.api.ldap.model.filter; 022 023/** 024 * Root expression node interface which all expression nodes in the filter 025 * expression tree implement. 026 * 027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 028 */ 029public interface ExprNode extends Cloneable 030{ 031 /** 032 * Gets an annotation on the tree by key. 033 * 034 * @param key the annotation key. 035 * @return the annotation value. 036 */ 037 Object get( Object key ); 038 039 040 /** 041 * Sets a annotation key to a value. 042 * 043 * @param key the annotation key. 044 * @param value the annotation value. 045 */ 046 void set( String key, Object value ); 047 048 049 /** 050 * Tests to see if this node is a leaf or branch node. 051 * 052 * @return true if the node is a leaf,false otherwise 053 */ 054 boolean isLeaf(); 055 056 057 /** 058 * Tells if this Node is Schema aware. 059 * 060 * @return true if the Node is SchemaAware 061 */ 062 boolean isSchemaAware(); 063 064 065 /** 066 * Gets the assertion type of this node. Make it possible to use switch 067 * statements on the node type. 068 * 069 * @return the assertion type 070 */ 071 AssertionType getAssertionType(); 072 073 074 /** 075 * Recursively appends the refinement string representation of this node and its 076 * descendants in prefix notation to a buffer. 077 * 078 * @param buf the buffer to append to. 079 * @return The buffer in which the refinement has been appended 080 * @throws UnsupportedOperationException if this node isn't a part of a refinement. 081 */ 082 StringBuilder printRefinementToBuffer( StringBuilder buf ); 083 084 085 /** 086 * Element/node accept method for visitor pattern. 087 * 088 * @param visitor the filter expression tree structure visitor 089 * @return the modified element 090 */ 091 Object accept( FilterVisitor visitor ); 092 093 094 /** 095 * Clone this expression node. 096 * 097 * @return the cloned expression node 098 */ 099 ExprNode clone(); 100}