org.apache.directory.api.ldap.model.filter
Class AbstractExprNode

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

public abstract class AbstractExprNode
extends Object
implements ExprNode

Abstract implementation of a expression node.

Author:
Apache Directory Project

Field Summary
protected  Map<String,Object> annotations
          The map of annotations
protected  AssertionType assertionType
          The node type
protected  boolean isSchemaAware
          A flag set to true if the Node is Schema aware
 
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()
           
 boolean isSchemaAware()
          Tells if this Node is Schema aware.
 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.api.ldap.model.filter.ExprNode
accept, isLeaf
 

Field Detail

annotations

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


assertionType

protected final AssertionType assertionType
The node type


isSchemaAware

protected boolean isSchemaAware
A flag set to true if the Node is Schema aware

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()

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:
ExprNode#set(java.lang.Object, java.lang.Object)

getAnnotations

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

Returns:
the annotation map.

isSchemaAware

public boolean isSchemaAware()
Tells if this Node is Schema aware.

Specified by:
isSchemaAware in interface ExprNode
Returns:
true if the Node is SchemaAware

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:
the cloned expression node

toString

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


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.