org.apache.directory.shared.ldap.filter
Class AbstractExprNode

java.lang.Object
  extended by org.apache.directory.shared.ldap.filter.AbstractExprNode
All Implemented Interfaces:
Cloneable, ExprNode
Direct Known Subclasses:
AssertionNode, BranchNode, LeafNode, ScopeNode

public abstract class AbstractExprNode
extends Object
implements ExprNode

Abstract implementation of a expression node.

Version:
$Rev: 912436 $
Author:
Apache Directory Project

Field Summary
protected  Map<String,Object> annotations
          The map of annotations
protected  AssertionType assertionType
          The node type
 
Constructor Summary
protected AbstractExprNode(AssertionType assertionType)
          Creates a node by setting abstract node type.
 
Method Summary
 ExprNode clone()
          Clone the object
 boolean equals(Object o)
           
protected static Value<?> escapeFilterValue(Value<?> value)
          Handles the escaping of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.
 Object get(Object key)
          Gets an annotation on the tree by key.
protected  Map<String,Object> getAnnotations()
          Gets the annotations as a Map.
 AssertionType getAssertionType()
          Gets the assertion type of this node.
 int hashCode()
           
abstract  boolean isLeaf()
          Tests to see if this node is a leaf or branch node.
 StringBuilder printRefinementToBuffer(StringBuilder buf)
          Default implementation for this method : just throw an exception.
 void set(String key, Object value)
          Sets a annotation key to a value.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.filter.ExprNode
accept
 

Field Detail

annotations

protected Map<String,Object> annotations
The map of annotations


assertionType

protected final AssertionType assertionType
The node type

Constructor Detail

AbstractExprNode

protected AbstractExprNode(AssertionType assertionType)
Creates a node by setting abstract node type.

Parameters:
assertionType - The node's type
Method Detail

getAssertionType

public AssertionType getAssertionType()
Description copied from interface: ExprNode
Gets the assertion type of this node. Make it possible to use switch statements on the node type.

Specified by:
getAssertionType in interface ExprNode
Returns:
the node's type
See Also:
ExprNode.getAssertionType()

isLeaf

public abstract boolean isLeaf()
Tests to see if this node is a leaf or branch node.

Specified by:
isLeaf in interface ExprNode
Returns:
true if the node is a leaf,false otherwise

equals

public boolean equals(Object o)
Overrides:
equals in class Object
Returns:
true if both objects are equal
See Also:
Object.equals(Object)

escapeFilterValue

protected static Value<?> escapeFilterValue(Value<?> value)
Handles the escaping of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515. Needed so that ExprNode#printToBuffer(StringBuffer) results in a valid filter string that can be parsed again (as a way of cloning filters).

Parameters:
value - Right hand side of "attrId=value" assertion occurring in an LDAP search filter.
Returns:
Escaped version of value

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
the instance's hash code
See Also:
Object.hashCode()

get

public Object get(Object key)
Description copied from interface: ExprNode
Gets an annotation on the tree by key.

Specified by:
get in interface ExprNode
Parameters:
key - the annotation key.
Returns:
the annotation value.
See Also:
ExprNode.get(java.lang.Object)

set

public void set(String key,
                Object value)
Description copied from interface: ExprNode
Sets a annotation key to a value.

Specified by:
set in interface ExprNode
Parameters:
key - the annotation key.
value - the annotation value.
See Also:
org.apache.directory.shared.ldap.filter.ExprNode#set(java.lang.Object, java.lang.Object)

getAnnotations

protected Map<String,Object> getAnnotations()
Gets the annotations as a Map.

Returns:
the annotation map.

printRefinementToBuffer

public StringBuilder printRefinementToBuffer(StringBuilder buf)
Default implementation for this method : just throw an exception.

Specified by:
printRefinementToBuffer in interface ExprNode
Parameters:
buf - the buffer to append to.
Returns:
The buffer in which the refinement has been appended
Throws:
UnsupportedOperationException - if this node isn't a part of a refinement.

clone

public ExprNode clone()
Clone the object

Specified by:
clone in interface ExprNode
Overrides:
clone in class Object
Returns:

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.